From ac62c24c4a71b79f6fd5c67406f871151fae0fe7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 27 Feb 2016 11:06:01 -0800 Subject: [PATCH] Cleanup passing stack around since `Stac#set` returns the stack. --- lodash.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lodash.js b/lodash.js index 1a488d429..59fe11057 100644 --- a/lodash.js +++ b/lodash.js @@ -4808,10 +4808,8 @@ if (stacked) { return stacked == other; } - stack.set(object, other); - // Recursively compare objects (susceptible to call stack limits). - return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack); + return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack.set(object, other)); case symbolTag: if (symbolValueOf) { @@ -5375,11 +5373,9 @@ * @returns {*} Returns the value to assign. */ function mergeDefaults(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); - } - return objValue; + return (isObject(objValue) && isObject(srcValue)) + ? baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue)) + : objValue; } /**