halis-state
Manage immutable state with these helpers for Objects and Arrays
Install
npm install halis-state --save
If you download the git repo
npm install && npm run test
Usage
Minimal usage:
const util = ; util; // trueutil; // trueutil; // falseutil; // false util; // trueutil; // false util; // trueutil; // false // return the object or an empty objectutil; // {}util; // { hello: 'world' } // return the array or an empty arrayutil; // []util; // [ 1, 2, 3 ] // returns a new copy of the objectutil; // { hello: 'world' }// can merge tooutil; // { hello: 'world', name: 'bob' } // returns a new copy of the arrayutil; // [ 1, 2 ]// can merge tooutil; // [ 1, 2, 3, 4 ] // new copy of object with new key and valueutil; // { hello: 'world', name: 'bob' } // new copy of array with new value pushedutil; // [ 1, 2, 3, 4 ] // remove key from objectutil; // {} // new copy of array with index removedutil; // [ 1, 3 ]// new copy of array with negative index removed from end of arayutil; // [ 1, 2 ]