mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v4.0.0.
This commit is contained in:
29
defaultsDeep.js
Normal file
29
defaultsDeep.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import apply from './internal/apply';
|
||||
import mergeDefaults from './internal/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 _
|
||||
* @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;
|
||||
Reference in New Issue
Block a user