Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
839 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var apply = require('./_apply'),
|
---|
| 2 | baseRest = require('./_baseRest'),
|
---|
| 3 | customDefaultsMerge = require('./_customDefaultsMerge'),
|
---|
| 4 | mergeWith = require('./mergeWith');
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * This method is like `_.defaults` except that it recursively assigns
|
---|
| 8 | * default properties.
|
---|
| 9 | *
|
---|
| 10 | * **Note:** This method mutates `object`.
|
---|
| 11 | *
|
---|
| 12 | * @static
|
---|
| 13 | * @memberOf _
|
---|
| 14 | * @since 3.10.0
|
---|
| 15 | * @category Object
|
---|
| 16 | * @param {Object} object The destination object.
|
---|
| 17 | * @param {...Object} [sources] The source objects.
|
---|
| 18 | * @returns {Object} Returns `object`.
|
---|
| 19 | * @see _.defaults
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
---|
| 23 | * // => { 'a': { 'b': 2, 'c': 3 } }
|
---|
| 24 | */
|
---|
| 25 | var defaultsDeep = baseRest(function(args) {
|
---|
| 26 | args.push(undefined, customDefaultsMerge);
|
---|
| 27 | return apply(mergeWith, undefined, args);
|
---|
| 28 | });
|
---|
| 29 |
|
---|
| 30 | module.exports = defaultsDeep;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.