Skip to main content

assignIn

_.assignIn(object, sources) # Ⓢ [Ⓣ][1] Ⓝ

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



inherited source properties.




Since​

4.0.0

Aliases​

_.extend

Arguments​

  1. object (Object): The destination object.
  2. sources (Object|Object[]): The source objects.

Returns​

(Object): Returns object.

Example​

function Foo() {
this.a = 1;
}

function Bar() {
this.c = 3;
}

Foo.prototype.b = 2;
Bar.prototype.d = 4;

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