From b9b94609f5b7085f60aa07f6317e47ee7706f513 Mon Sep 17 00:00:00 2001 From: Xotic750 Date: Tue, 3 Nov 2015 15:53:50 +0100 Subject: [PATCH] Enhance `_.debounce` to use `toNumber`. --- lodash.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.js b/lodash.js index e1db32d8b..c06af976d 100644 --- a/lodash.js +++ b/lodash.js @@ -8146,10 +8146,10 @@ if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - wait = wait < 0 ? 0 : (+wait || 0); + wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; - maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); + maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait); trailing = 'trailing' in options ? !!options.trailing : trailing; } @@ -8285,7 +8285,7 @@ * // => logs 'later' after one second */ var delay = rest(function(func, wait, args) { - return baseDelay(func, toNumber(wait), args); + return baseDelay(func, toNumber(wait) || 0, args); }); /**