defaultsDeep source npm

_.defaultsDeep(object, [sources])

This method is like _.defaults except that it recursively assigns default properties.

Note: This method mutates object.

Arguments

  1. object (Object)

    The destination object.

  2. [sources] (...Object)

    The source objects.

Returns (Object)

Returns object.

Example

_.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
// => { 'user': { 'name': 'barney', 'age': 36 } }