Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

uqee/immutability-helper-x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What

Additional functions for the immutability-helper tool.

Getting started

  1. Install
yarn add @uqee/immutability-helper-x
  1. Test
yarn test
  1. 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 }

About

Additional functions for the immutability-helper tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published