4.17.11
3.10.1
2.4.2
1.3.1

_.defaultsDeep(object, [sources])

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

Note: This method mutates object.

Since

3.10.0

Arguments

argument
object
[sources]
type
Object
...Object
description
The destination object.
The source objects.

Returns

(array)

Example

_.defaultsDeep(
  { a: { b: 2 } },
  { a: { b: 1, c: 3 } }
);
// => { 'a': { 'b': 2, 'c': 3 } }
_.defaultsDeep({ a: { b: 2 } }, { a: { b: 1, c: 3 } });
// => { 'a': { 'b': 2, 'c': 3 } }