Files
lodash/defaultsDeep.js
John-David Dalton ce0b51888c Bump to v4.7.0.
2016-03-31 00:36:47 -07:00

31 lines
821 B
JavaScript

import apply from './_apply';
import mergeDefaults from './_mergeDefaults';
import mergeWith from './mergeWith';
import rest from './rest';
/**
* This method is like `_.defaults` except that it recursively assigns
* default properties.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @example
*
* _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
* // => { 'user': { 'name': 'barney', 'age': 36 } }
*
*/
var defaultsDeep = rest(function(args) {
args.push(undefined, mergeDefaults);
return apply(mergeWith, undefined, args);
});
export default defaultsDeep;