@uqee/immutability-helper-x
v0.3.1
Published
Additional functions for the [`immutability-helper`](https://github.com/kolodny/immutability-helper) tool.
Downloads
3
Readme
What
Additional functions for the immutability-helper
tool.
Getting started
- Install
yarn add @uqee/immutability-helper-x
- Test
yarn test
- Use
import update from 'immutability-helper';
import {
arrayDelete,
arrayPushUnique,
objectDelete,
} from '@uqee/immutability-helper-x';
update.extend('$pop', arrayDelete);
update.extend('$pushuniq', arrayPushUnique);
update.extend('$del', objectDelete);
Reference
Exported function | Description | Example
----------------- | ----------- | -------
arrayDelete
| Remove items from an array | update([1, 2, 3], { $pop: [1, 3] }) -> [2]
arrayPushUnique
| Push items to a unique-items array | update([1, 2, 3], { $pushuniq: [2, 3, 4] }) -> [1, 2, 3, 4]
objectDelete
| Remove keys form an object | update({ foo: 1, bar: 2 }, { $del: ['bar', 'baz'] }) -> { foo: 1 }