Adds a value by a string path, with '.' as a the default delimiter Automatically generates intermediate nodes.
const root = addValueByPath({}, 'c');addValueByPath({x:'blah'}, 'c.users.admin', root); Copy
const root = addValueByPath({}, 'c');addValueByPath({x:'blah'}, 'c.users.admin', root);
Creates the structure:
c value: { } label: c+ users value: undefined label: users + admin value: { x: 'blah' } label: admin Copy
c value: { } label: c+ users value: undefined label: users + admin value: { x: 'blah' } label: admin
By default, multiple values under same key are overwritten, with the most recent winning.
Optional
Adds a value by a string path, with '.' as a the default delimiter Automatically generates intermediate nodes.
Creates the structure:
By default, multiple values under same key are overwritten, with the most recent winning.