-
-
Save phpsmarter/a20b12da9f29fa11d186e5ffb47add52 to your computer and use it in GitHub Desktop.
Composing lenses in Ramda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { lensPath, view } from 'ramda'; | |
const complexObject = { level1: { level2: { prop1: 1, prop2: 2 } } }; | |
const prop1Lens = lensPath(['level1', 'level2', 'prop1']); | |
console.assert(view(prop1Lens, complexObject) === 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment