Type-safe immutability helpers for simple objects and arrays
npm install typescript-immutable-utilsType-safe immutability helpers for simple objects and arrays.
```
npm install --save typescript-immutable-utils
* setAt
Returns new array with replaced item at given index.
If item is equal to the old one, original array is returned.
* insertAt
Returns new array with inserted item at given index.
If index is negative, counts from the end of the array.
* removeAt
Returns new array with removed item at given index.
If index is out of bounds, original array is returned.
If index is negative, counts from the end of the array.
* removeValue
Returns new array with given value removed.
If value is not present in the array, it is returned unchanged.
* update
Returns new object with updated values.
If all values are the same, original object is returned.
* mapValues
Returns new Map with updated values
Dictionary type is a simple index signature:
`ts`
type Dict
* createDict
Creates empty dict.
* copyDict
Copies given dict.
* hasKey(dict: Dict
Checks whether dict has given key.
* mapValues
Creates new dict with same keys as given dict whose values are the result of
applying mapping function on given dict values.
If every returned value is the same as in original dict, original dict is
returned.
* union
Creates new dict with values from both given dicts.
* setKey
Returns new dict with given key set to given value.
If the value is the same as in original dict, original dict is returned.
* removeKey
Returns new dict with given keys removed.
If none of the keys are present in original dict, original dict is returned.
* fromKeys
If values is not a function, creates new dict with given keys whose values arevalues
all the same and equal to .
If values` is function, creates new dict with given keys whose values are the
result of applying this function to the key.
[npm-image]: https://badge.fury.io/js/typescript-immutable-utils.svg
[npm-url]: https://badge.fury.io/js/typescript-immutable-utils
[travis-image]: https://travis-ci.org/aikoven/typescript-immutable-utils.svg?branch=master
[travis-url]: https://travis-ci.org/aikoven/typescript-immutable-utils