Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Schniz/ramda-immutable. Immutable.js helpers for Ramda
Something went wrong. Try again.
12345678910111213141516171819202122// @flow
import { lens, compose } from 'ramda';
type Lens = Function;type Key = any;type Path = Array<Key>;
export const lensProp : (key : Key) => Lens = key => { return lens( obj => obj.get(key), (val, obj) => obj.set(key, val), );};
export const lensIndex : (key : number) => Lens = lensProp;
export const lensPath : (path : Path) => Lens = path => { const lenses = path.map(lensProp); return compose(...lenses);};