4.17.11
3.10.1
2.4.2
1.3.1
_.updateWith(object, path, updater, [customizer])
This method is like _.update except that it accepts customizer which is
invoked to produce the objects of path. If customizer returns undefined
path creation is handled by the method instead. The customizer is invoked
with three arguments: (nsValue, key, nsObject).
Note: This method mutates object.
Since
4.6.0
Arguments
argument
objectpathupdater[customizer]type
Object
(Array|string)
Function
Function
description
The object to modify.
The path of the property to set.
The function to produce the updated value.
The function to customize assigned values.
Returns
(array)Example
var object = {};
_.updateWith(
object,
"[0][1]",
_.constant("a"),
Object
);
// => { '0': { '1': 'a' } }
var object = {};
_.updateWith(object, "[0][1]", _.constant("a"), Object);
// => { '0': { '1': 'a' } }