Ensure wait of _.debounce and _.throttle defaults to 0. [closes #991]

This commit is contained in:
jdalton
2015-02-23 08:28:02 -08:00
parent 6840b2cfe5
commit 44006142c7
2 changed files with 25 additions and 3 deletions

View File

@@ -7376,7 +7376,7 @@
* @memberOf _
* @category Function
* @param {Function} func The function to debounce.
* @param {number} wait The number of milliseconds to delay.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
@@ -7434,7 +7434,7 @@
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = wait < 0 ? 0 : wait;
wait = wait < 0 ? 0 : (+wait || 0);
if (options === true) {
var leading = true;
trailing = false;
@@ -7955,7 +7955,7 @@
* @memberOf _
* @category Function
* @param {Function} func The function to throttle.
* @param {number} wait The number of milliseconds to throttle invocations to.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=true] Specify invoking on the leading
* edge of the timeout.