immut-set
Version:
A small helper function, which exposes an immutable version of lodash.set
49 lines (40 loc) • 507 B
Markdown
# immut-set
> A small helper function, which exposes an immutable version of lodash.set
## Installation
Using npm:
```sh
npm install immut-set --save
```
## Usage
Basic example:
```javascript
const set = require('immut-set')
const object = {
'a': [{
'b': {
'c': 1
}
}]
}
const updatedObject = set(object, 'a[0].b.c', 0)
console.log(object)
/*
{
'a': [{
'b': {
'c': 1
}
}]
}
*/
console.log(updatedObject)
/*
{
'a': [{
'b': {
'c': 0
}
}]
}
*/
```