From e124e7fb5fb15a8eca8f12d57fc3393f979cf0ae Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 16 May 2016 01:00:26 -0700 Subject: [PATCH] Init `lastCallTime` as `undefined` to avoid issues when the sytem time is `0`. [closes #2342] --- lodash.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lodash.js b/lodash.js index 9315671a8..1511149b3 100644 --- a/lodash.js +++ b/lodash.js @@ -9606,7 +9606,7 @@ maxWait, result, timerId, - lastCallTime = 0, + lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, @@ -9657,7 +9657,7 @@ // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. - return (!lastCallTime || (timeSinceLastCall >= wait) || + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } @@ -9687,8 +9687,8 @@ if (timerId !== undefined) { clearTimeout(timerId); } - lastCallTime = lastInvokeTime = 0; - lastArgs = lastThis = timerId = undefined; + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() {