unsafe-assign
v1.0.0
Published
Assign to an object at an inner property, creating intermediate properties if necessary, clobbering anything in it's way
Downloads
1
Maintainers
Readme
unsafe-assign
Assign to an object at an inner property, createing intermediate properties if necessary. Does not support intermediate arrays like lodash.set. Returns the original, modified object.
- tiny
- no dependencies
import assign from 'unsafe-assign';
let obj = {
a: 'will be clobbered'
}
assign(obj, 'a.aa', {b: 'c'});
assign(obj, 'a.aa', {c: 'd'});
//{a: {aa: {b: 'c', c: 'd'}}}