Sets a value at the given path of an object, creating nested objects if necessary.
The target object.
Dot-separated string path where the value should be set.
The value to set at the specified path.
const obj = {};set(obj, "a.b.c", 42);console.log(obj); // { a: { b: { c: 42 } } } Copy
const obj = {};set(obj, "a.b.c", 42);console.log(obj); // { a: { b: { c: 42 } } }
1.1.0
Sets a value at the given path of an object, creating nested objects if necessary.