diff --git a/lodash.js b/lodash.js index 0f44b8df7..c381a10f2 100644 --- a/lodash.js +++ b/lodash.js @@ -5737,21 +5737,22 @@ } lastCalled = stamp; result = func.apply(thisArg, args); + args = thisArg = null; } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } - if (!timeoutId && wait !== maxWait) { + if (isCalled & timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { isCalled = true; result = func.apply(thisArg, args); } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; - } return result; }; }