main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d565449] | 1 | import baseMerge from './_baseMerge.js';
|
---|
| 2 | import isObject from './isObject.js';
|
---|
| 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 | export default customDefaultsMerge;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.