Created
August 19, 2017 08:08
-
-
Save char0n/0a812a917c56f3bb6878f6ee4c5ea67d 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