mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Cleanup baseMerge.
This commit is contained in:
committed by
jdalton
parent
ae9ac3b439
commit
6dfb2997cb
@@ -2487,11 +2487,9 @@
|
|||||||
var isSrcArr = isArray(source) || isTypedArray(source);
|
var isSrcArr = isArray(source) || isTypedArray(source);
|
||||||
|
|
||||||
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) {
|
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) {
|
||||||
var isArr = isArray(srcValue) || isTypedArray(srcValue),
|
var value = object[key];
|
||||||
isObj = isPlainObject(srcValue),
|
|
||||||
value = object[key];
|
|
||||||
|
|
||||||
if (!(isArr || isObj)) {
|
if (!isObjectLike(srcValue)) {
|
||||||
var result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
|
var result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
|
||||||
isCommon = typeof result == 'undefined';
|
isCommon = typeof result == 'undefined';
|
||||||
|
|
||||||
@@ -2519,9 +2517,12 @@
|
|||||||
isCommon = typeof result == 'undefined';
|
isCommon = typeof result == 'undefined';
|
||||||
|
|
||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
result = isArr
|
result = srcValue;
|
||||||
? (isArray(value) ? value : [])
|
if (isArray(srcValue) || isTypedArray(srcValue)) {
|
||||||
: (isPlainObject(value) ? value : {});
|
result = isArray(value) ? value : [];
|
||||||
|
} else if (isPlainObject(srcValue)) {
|
||||||
|
result = isPlainObject(value) ? value : {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Add the source value to the stack of traversed objects and associate
|
// Add the source value to the stack of traversed objects and associate
|
||||||
// it with its merged value.
|
// it with its merged value.
|
||||||
|
|||||||
Reference in New Issue
Block a user