lens

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
5
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
2 KB
Returns a lens for the given getter and setter functions.
1 contributor
Install lens as a package?
Copied
npm i @bit/justin-capalbo.ramda.lens
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
lens (
getter:Function,
setter:Function
) : Lens

Returns a lens for the given getter and setter functions. The getter “gets” the value of the focus; the setter “sets” the value of the focus. The setter should not mutate the data structure.

Example
const xLens = R.lens(R.prop('x'), R.assoc('x'));

     R.view(xLens, {x: 1, y: 2});            //=> 1
     R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}
     R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}
Arguments
getter: Function
setter: Function
Returns
Lens

Help and resources