assignIn extend source npm

_.assignIn(object, [sources])

This method is like _.assign except that it iterates over own and inherited source properties.

Note: This method mutates object.

Arguments

  1. object (Object)

    The destination object.

  2. [sources] (...Object)

    The source objects.

Returns (Object)

Returns object.

Example

function Foo() {
  this.b = 2;
}

function Bar() {
  this.d = 4;
}

Foo.prototype.c = 3;
Bar.prototype.e = 5;

_.assignIn({ 'a': 1 }, new Foo, new Bar);
// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }