From 277c9bdc7cbd62f438c65891dd2dfda37632a5b7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 29 Mar 2016 08:38:46 -0700 Subject: [PATCH] Make `shouldInvoke` explicitly return `true` if it's the first call. --- lodash.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lodash.js b/lodash.js index 2944a4288..22d89ea2e 100644 --- a/lodash.js +++ b/lodash.js @@ -9294,14 +9294,11 @@ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; - // Either 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 ( - (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || - (maxWait !== false && timeSinceLastInvoke >= maxWait) - ); + // 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) || + (timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait)); } function timerExpired() {