Ensure _.mergeWith overwrites primitives with source object clones. [closes #1880]

This commit is contained in:
John-David Dalton
2016-01-25 20:09:17 -08:00
parent 8a7fce41bb
commit 8048f015e5
2 changed files with 13 additions and 1 deletions

View File

@@ -3057,7 +3057,7 @@
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
srcValue = source[key],
stacked = stack.get(srcValue) || stack.get(objValue);
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
@@ -3076,6 +3076,7 @@
newValue = copyArray(objValue);
}
else {
isCommon = false;
newValue = baseClone(srcValue);
}
}
@@ -3084,6 +3085,7 @@
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
isCommon = false;
newValue = baseClone(srcValue);
}
else {