From c7b9df4286d870546afc1ee717e3eda0014db1e2 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 3 Oct 2016 18:06:07 -0700 Subject: [PATCH] Cleanup branching for array-likes in `baseMergeDeep`. --- lodash.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lodash.js b/lodash.js index 4c50ece9e..f6ff8692f 100644 --- a/lodash.js +++ b/lodash.js @@ -3631,21 +3631,24 @@ if (isCommon) { var isArr = isArray(srcValue), - isTyped = !isArr && isTypedArray(srcValue); + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; - if (isArr || isTyped) { + if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } else if (isTyped) { isCommon = false; - newValue = isBuffer(srcValue) - ? cloneBuffer(srcValue, true) - : cloneTypedArray(srcValue, true); + newValue = cloneTypedArray(srcValue, true); } else { newValue = [];