Object.assign >= 0.1.0

Purpose

Inject the enumerable properties of one object into another target object

Syntax

Object.assign ( Objecttarget Objectfirst Objectsecond Object... );

Parameters

target
The target object that gets modified
first
second
...

Return values

Object

The `target` argument also gets returned

Examples

Adding properties of several objects into a new one

var target = {},
    obj1   = {one: 1, two: 2},
    obj2   = {three: 3};

Object.assign(target, obj1, obj2);>>> Object { one: 1, two: 2, three: 3 }

Using it to override defaults

var target = {},
    defaults,
    options;
    
defaults = {
    a: 'default',
    b: 'default',
    c: 'default'
};

options = {
    b : 'overwritten'
};

Object.assign(target, defaults, options);>>> Object { a: "default", b: "overwritten", c: "default" }