lodash.throttle
Advanced tools
Comparing version 4.1.0 to 4.1.1
75
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/) | ||
@@ -251,4 +262,4 @@ * for details over the differences between `_.debounce` and `_.throttle`. | ||
* method to cancel 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` | ||
* immediately invoke them. 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 | ||
@@ -262,2 +273,5 @@ * throttled function. Subsequent calls to the throttled function return the | ||
* | ||
* 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/) | ||
@@ -309,29 +323,4 @@ * for details over the differences between `_.throttle` and `_.debounce`. | ||
/** | ||
* 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('')`) | ||
@@ -445,3 +434,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; | ||
@@ -448,0 +437,0 @@ } |
{ | ||
"name": "lodash.throttle", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "The lodash method `_.throttle` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.throttle v4.1.0 | ||
# lodash.throttle v4.1.1 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.throttle` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#throttle) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.throttle) for more details. | ||
See the [documentation](https://lodash.com/docs#throttle) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.throttle) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
16478
400