Object.merge >= 0.1.9

Purpose

Like `Object.assign`, but merge objects recursively

Syntax

Object.merge ( ObjecttargetObjectfirstObjectsecondObject... );

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

Kandi

I discovered your site from Google and also I need to claim it was a fantastic locate. Many thanks!