From 96553b217c10a3147614e9f156d169edc1bb6dd1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 13 Oct 2012 20:58:39 -0700 Subject: [PATCH] Reduce `_.merge`. Former-commit-id: 5797e14e589d39e553d7af109d282109e633cd80 --- lodash.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lodash.js b/lodash.js index ada830bdc..5599583d5 100644 --- a/lodash.js +++ b/lodash.js @@ -1665,17 +1665,15 @@ * _.merge(stooges, ages); * // => [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] */ - function merge(object, source, indicator) { + function merge(object, source, indicator, stackA, stackB) { var args = arguments, index = 0, - length = 2, - stackA = args[3], - stackB = args[4]; + length = 2; if (indicator != compareAscending) { - length = args.length; stackA = []; stackB = []; + length = args.length; } while (++index < length) { forOwn(args[index], function(source, key) { @@ -3476,18 +3474,18 @@ return function() { var now = new Date, - remain = wait - (now - lastCalled); + remaining = wait - (now - lastCalled); args = arguments; thisArg = this; - if (remain <= 0) { + if (remaining <= 0) { clearTimeout(timeoutId); lastCalled = now; result = func.apply(thisArg, args); } else if (!timeoutId) { - timeoutId = setTimeout(trailingCall, remain); + timeoutId = setTimeout(trailingCall, remaining); } return result; };