Last change
on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | var baseMerge = require('./_baseMerge'),
|
---|
| 2 | isObject = require('./isObject');
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
---|
| 6 | * objects into destination objects that are passed thru.
|
---|
| 7 | *
|
---|
| 8 | * @private
|
---|
| 9 | * @param {*} objValue The destination value.
|
---|
| 10 | * @param {*} srcValue The source value.
|
---|
| 11 | * @param {string} key The key of the property to merge.
|
---|
| 12 | * @param {Object} object The parent object of `objValue`.
|
---|
| 13 | * @param {Object} source The parent object of `srcValue`.
|
---|
| 14 | * @param {Object} [stack] Tracks traversed source values and their merged
|
---|
| 15 | * counterparts.
|
---|
| 16 | * @returns {*} Returns the value to assign.
|
---|
| 17 | */
|
---|
| 18 | function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
---|
| 19 | if (isObject(objValue) && isObject(srcValue)) {
|
---|
| 20 | // Recursively merge objects and arrays (susceptible to call stack limits).
|
---|
| 21 | stack.set(srcValue, objValue);
|
---|
| 22 | baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
---|
| 23 | stack['delete'](srcValue);
|
---|
| 24 | }
|
---|
| 25 | return objValue;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | module.exports = customDefaultsMerge;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.