Sets an objects key by keypath array then returns the object.
If keypath does not have any keys, the object will not be mutated, and the value to assign will just be returned.
const obj = { a: { b: ["c"]} }// mutates and returns the mutated objset(obj, ["a", "b", 0], "d")// obj.a.b[0] is now "d"obj2 = set(obj, [], {}, {noError:true})// obj is still the above, obj2 is {} Copy
const obj = { a: { b: ["c"]} }// mutates and returns the mutated objset(obj, ["a", "b", 0], "d")// obj.a.b[0] is now "d"obj2 = set(obj, [], {}, {noError:true})// obj is still the above, obj2 is {}
Sets an objects key by keypath array then returns the object.
If keypath does not have any keys, the object will not be mutated, and the value to assign will just be returned.