[READ-ONLY] Mirror of https://github.com/Schniz/ramda-immutable. Immutable.js helpers for Ramda
0

Configure Feed

Select the types of activity you want to include in your feed.

JavaScript 79.1%
Other 20.9%
6 1 1

Clone this repository

https://tangled.org/schlez.in/ramda-immutable https://tangled.org/did:plc:o3uwd5vd2hllbfu4mtiakkky
git@tangled.org:schlez.in/ramda-immutable git@tangled.org:did:plc:o3uwd5vd2hllbfu4mtiakkky

For self-hosted knots, clone URLs may differ based on your setup.



README.md

ramda-immutable#

Helpers for using ramda with immutable.js

Currently only provides lenses using the lens function.

Installing#

npm install --save ramda-immutable

Make sure you install ramda and immutable too cause they are peer dependencies.

Helpers#

lensProp and lensIndex#

import { set } from 'ramda';
import { lensProp } from 'ramda-immutable';
import { fromJS } from 'immutable';

const feelingLens = lensProp('feeling');
const afterSet = set(
	feelingLens,
	'awesome',
	fromJS({ id: 1, feeling: 'sad' })
); // => { id: 1, feeling: 'yay!' }

the only difference between lensIndex and lensProp is the key type.

lensPath#

creating a path of lenses.

import { set } from 'ramda';
import { lensPath } from 'ramda-immutable';
import { fromJS } from 'immutable';

const afterSet = set(
	lensPath([0, 'sad']),
	'awesome',
	fromJS([{ id: 1, feeling: 'sad' }, { id: 2, feeling: 'good' }]),
);