lodash.debounce
Advanced tools
Comparing version 4.0.7 to 4.0.8
68
index.js
@@ -17,5 +17,3 @@ /** | ||
/** `Object#toString` result references. */ | ||
var funcTag = '[object Function]', | ||
genTag = '[object GeneratorFunction]', | ||
symbolTag = '[object Symbol]'; | ||
var symbolTag = '[object Symbol]'; | ||
@@ -37,2 +35,11 @@ /** Used to match leading and trailing whitespace. */ | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = freeGlobal || freeSelf || Function('return this')(); | ||
/** Used for built-in method references. */ | ||
@@ -43,3 +50,3 @@ var objectProto = Object.prototype; | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -69,5 +76,5 @@ */ | ||
*/ | ||
function now() { | ||
return Date.now(); | ||
} | ||
var now = function() { | ||
return root.Date.now(); | ||
}; | ||
@@ -79,11 +86,15 @@ /** | ||
* delayed `func` invocations and a `flush` method to immediately invoke them. | ||
* Provide an options object to indicate whether `func` should be invoked on | ||
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked | ||
* with the last arguments provided to the debounced function. Subsequent calls | ||
* to the debounced function return the result of the last `func` invocation. | ||
* Provide `options` to indicate whether `func` should be invoked on the | ||
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked | ||
* with the last arguments provided to the debounced function. Subsequent | ||
* calls to the debounced function return the result of the last `func` | ||
* invocation. | ||
* | ||
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked | ||
* on the trailing edge of the timeout only if the debounced function is | ||
* invoked more than once during the `wait` timeout. | ||
* **Note:** If `leading` and `trailing` options are `true`, `func` is | ||
* invoked on the trailing edge of the timeout only if the debounced function | ||
* is invoked more than once during the `wait` timeout. | ||
* | ||
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred | ||
* until to the next tick, similar to `setTimeout` with a timeout of `0`. | ||
* | ||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) | ||
@@ -248,29 +259,4 @@ * for details over the differences between `_.debounce` and `_.throttle`. | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | ||
* @example | ||
* | ||
* _.isFunction(_); | ||
* // => true | ||
* | ||
* _.isFunction(/abc/); | ||
* // => false | ||
*/ | ||
function isFunction(value) { | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in Safari 8 which returns 'object' for typed array and weak map constructors, | ||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances. | ||
var tag = isObject(value) ? objectToString.call(value) : ''; | ||
return tag == funcTag || tag == genTag; | ||
} | ||
/** | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
@@ -384,3 +370,3 @@ * | ||
if (isObject(value)) { | ||
var other = isFunction(value.valueOf) ? value.valueOf() : value; | ||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value; | ||
value = isObject(other) ? (other + '') : other; | ||
@@ -387,0 +373,0 @@ } |
{ | ||
"name": "lodash.debounce", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"description": "The lodash method `_.debounce` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.debounce v4.0.7 | ||
# lodash.debounce v4.0.8 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.debounce` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#debounce) or [package source](https://github.com/lodash/lodash/blob/4.0.7-npm-packages/lodash.debounce) for more details. | ||
See the [documentation](https://lodash.com/docs#debounce) or [package source](https://github.com/lodash/lodash/blob/4.0.8-npm-packages/lodash.debounce) for more details. |
13951
340