From ce33af6bb5014039b33f36350b7c65aa76041762 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 12 Jan 2013 13:47:13 -0800 Subject: [PATCH] Cleanup `_.merge`. Former-commit-id: 4227c403f89a1085ce88ca992106b7ed0a3c210c --- lodash.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lodash.js b/lodash.js index c98c69c77..13e11ce1e 100644 --- a/lodash.js +++ b/lodash.js @@ -1774,15 +1774,12 @@ // avoid merging previously merged cyclic sources var stackLength = stackA.length; while (stackLength--) { - found = stackA[stackLength] == source; - if (found) { + if ((found = stackA[stackLength] == source)) { + object[key] = stackB[stackLength]; break; } } - if (found) { - object[key] = stackB[stackLength]; - } - else { + if (!found) { // add `source` and associated `value` to the stack of traversed objects stackA.push(source); stackB.push(value = (value = object[key], isArr)