Cleanup _.merge.

Former-commit-id: 4227c403f89a1085ce88ca992106b7ed0a3c210c
This commit is contained in:
John-David Dalton
2013-01-12 13:47:13 -08:00
parent fb9d4303f1
commit ce33af6bb5

View File

@@ -1774,15 +1774,12 @@
// avoid merging previously merged cyclic sources // avoid merging previously merged cyclic sources
var stackLength = stackA.length; var stackLength = stackA.length;
while (stackLength--) { while (stackLength--) {
found = stackA[stackLength] == source; if ((found = stackA[stackLength] == source)) {
if (found) { object[key] = stackB[stackLength];
break; break;
} }
} }
if (found) { if (!found) {
object[key] = stackB[stackLength];
}
else {
// add `source` and associated `value` to the stack of traversed objects // add `source` and associated `value` to the stack of traversed objects
stackA.push(source); stackA.push(source);
stackB.push(value = (value = object[key], isArr) stackB.push(value = (value = object[key], isArr)