mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Cleanup branching for array-likes in baseMergeDeep.
This commit is contained in:
13
lodash.js
13
lodash.js
@@ -3631,21 +3631,24 @@
|
|||||||
|
|
||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
var isArr = isArray(srcValue),
|
var isArr = isArray(srcValue),
|
||||||
isTyped = !isArr && isTypedArray(srcValue);
|
isBuff = !isArr && isBuffer(srcValue),
|
||||||
|
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
||||||
|
|
||||||
newValue = srcValue;
|
newValue = srcValue;
|
||||||
if (isArr || isTyped) {
|
if (isArr || isBuff || isTyped) {
|
||||||
if (isArray(objValue)) {
|
if (isArray(objValue)) {
|
||||||
newValue = objValue;
|
newValue = objValue;
|
||||||
}
|
}
|
||||||
else if (isArrayLikeObject(objValue)) {
|
else if (isArrayLikeObject(objValue)) {
|
||||||
newValue = copyArray(objValue);
|
newValue = copyArray(objValue);
|
||||||
}
|
}
|
||||||
|
else if (isBuff) {
|
||||||
|
isCommon = false;
|
||||||
|
newValue = cloneBuffer(srcValue, true);
|
||||||
|
}
|
||||||
else if (isTyped) {
|
else if (isTyped) {
|
||||||
isCommon = false;
|
isCommon = false;
|
||||||
newValue = isBuffer(srcValue)
|
newValue = cloneTypedArray(srcValue, true);
|
||||||
? cloneBuffer(srcValue, true)
|
|
||||||
: cloneTypedArray(srcValue, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newValue = [];
|
newValue = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user