The Object or Array in which to set the value
to.
either a path as a string
(separated by separator) or a (string|number)[]
array of path key names. @todo: test number[] too
the value to set, can be anything
options to use while walking the path:
separator: string = '/'
the separator to use when splitting the path string. Default is /
create: boolean = false
if truthy, it creates a new {}
for missing paths. If falsey, if there is a non z.isRealObject
while expanding the path, it doesn't create a new {}
and it doesn't set the value. Default is false
.
overwrite: string | boolean = false
if true (or truthy string), objects paths that don't exist are created, just like create: true
. But also, non z.isRealObject
values are replaced by a new {}
that will 'hold' this new path. If it is a String, then a key/prop by that name is created on the new {}
, holding the old value that was overwritten. Default is false
.
@todo: NOT IMPLEMENTED merge
{boolean} If true, objects at the same path are _.merge
, instead of overwritten.
true if the value was set, false if it wasn't set (eg because of create: false
or overwrite: false
)
Sets a value to an object, to a given path that's either:
a textual
string
path with a separator, egsome/path/in/object
a
string[]
of path names, eg['some', 'path', 'in', 'object']
There are a few twists while walking the path - see
options
param below.