Util.paths Module
Import
Methods
to(object, path, value, returnSourceObject)
to(object, path, value, returnSourceObject)
Search object
for a path using a dot syntax and returns a value. If the value
argument is present, the function writes the path to the object and returns the inner most object match, creating objects when none are present.
Arguments
object
(Object) The object to search or update.path
(String) The path to search or update. Sub-properties can be found/updated using a.
as a separator.value
(*) If present, writes to the innermost path. If any of the properties are missing from the path, they are created as plain javascript objects.returnSourceObject
(Boolean) If true, returnsobject
instead of the innermost property.
Returns
JavaScript
Last updated