Object.merge >= 0.1.9
Purpose
Like `Object.assign`, but merge objects recursively
Syntax
Object.merge
(
Objecttarget
Objectfirst
Objectsecond
Object...
);
Parameters
target
first
second
...
Return values
Object
The target object that gets modified
Examples
var first,
second;
first = {
a : {
x: 1,
y: 1,
z: 1
},
b : {
x: 1,
y: 1,
z: 1
}
};
second = {
a : {
z : 2
},
b : {
x : 2
}
};
Object.merge({}, first, second);>>> {"a":{"x":1,"y":1,"z":2},"b":{"x":2,"y":1,"z":1}}
Comments