object-path-immutable
object-path-immutable copied to clipboard
Ability to bind the chain mode to a slice of the object
immutable(object, 'path.to.slice')
const obj = {
a: {
b: 's1',
c: 1
}
}
immutable(obj, 'a')
.set('b', 's3')
.update('c', (v) => v+1)
.value()
/*
returns {
a: {
b: 's3',
c: 2
}
}
*/