* A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The s
(object, source, key, mergeFunc, customizer, stackA, stackB)
| 3958 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 3959 | */ |
| 3960 | function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { |
| 3961 | var length = stackA.length, |
| 3962 | srcValue = source[key]; |
| 3963 | |
| 3964 | while (length--) { |
| 3965 | if (stackA[length] == srcValue) { |
| 3966 | object[key] = stackB[length]; |
| 3967 | return; |
| 3968 | } |
| 3969 | } |
| 3970 | var value = object[key], |
| 3971 | result = customizer ? customizer(value, srcValue, key, object, source) : undefined, |
| 3972 | isCommon = result === undefined; |
| 3973 | |
| 3974 | if (isCommon) { |
| 3975 | result = srcValue; |
| 3976 | if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { |
| 3977 | result = isArray(value) |
| 3978 | ? value |
| 3979 | : (getLength(value) ? arrayCopy(value) : []); |
| 3980 | } |
| 3981 | else if (isPlainObject(srcValue) || isArguments(srcValue)) { |
| 3982 | result = isArguments(value) |
| 3983 | ? toPlainObject(value) |
| 3984 | : (isPlainObject(value) ? value : {}); |
| 3985 | } |
| 3986 | else { |
| 3987 | isCommon = false; |
| 3988 | } |
| 3989 | } |
| 3990 | // Add the source value to the stack of traversed objects and associate |
| 3991 | // it with its merged value. |
| 3992 | stackA.push(srcValue); |
| 3993 | stackB.push(result); |
| 3994 | |
| 3995 | if (isCommon) { |
| 3996 | // Recursively merge objects and arrays (susceptible to call stack limits). |
| 3997 | object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); |
| 3998 | } else if (result === result ? (result !== value) : (value === value)) { |
| 3999 | object[key] = result; |
| 4000 | } |
| 4001 | } |
| 4002 | |
| 4003 | /** |
| 4004 | * The base implementation of `_.property` without support for deep paths. |
no test coverage detected