updateDeep
Makes the values of an object match the values of an other object including all children values.
.updateDeep(target, source)
Updates the values (and properties if map-like) of target
to match the values of source
.
Removes properties from target
that are not on source
.
For map-like objects, every enumerable property on target
is copied:
var target = {name: {first: "Justin"}, age: 34};
var source = {name: {last: "Meyer"}};
var result = canReflect.updateDeep(target, source);
target //-> {name: {last: "Meyer"}}
An object can control the behavior of updateDeep
using the can.updateDeep symbol.
For list-like objects, a diff and patch strategy is used. This attempts to limit the number of changes.
Parameters
- target
{Object}
:The value that will be updated with
source
's values. - source
{Object}
:A source of values to copy to
target
.
Returns
{Object}
:
The target.