mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Update _.debounce and _.throttle doc examples and rebuild.
Former-commit-id: fc094e857aeae0ab9581ad56dca894cc96bc7b2e
This commit is contained in:
53
dist/lodash.js
vendored
53
dist/lodash.js
vendored
@@ -618,6 +618,24 @@
|
||||
return toString.call(value) == argsClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is an array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {Mixed} value The value to check.
|
||||
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
||||
* @example
|
||||
*
|
||||
* (function() { return _.isArray(arguments); })();
|
||||
* // => false
|
||||
*
|
||||
* _.isArray([1, 2, 3]);
|
||||
* // => true
|
||||
*/
|
||||
var isArray = nativeIsArray;
|
||||
|
||||
/**
|
||||
* A fallback implementation of `Object.keys` which produces an array of the
|
||||
* given object's own enumerable property names.
|
||||
@@ -1148,28 +1166,6 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is an array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {Mixed} value The value to check.
|
||||
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
||||
* @example
|
||||
*
|
||||
* (function() { return _.isArray(arguments); })();
|
||||
* // => false
|
||||
*
|
||||
* _.isArray([1, 2, 3]);
|
||||
* // => true
|
||||
*/
|
||||
function isArray(value) {
|
||||
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object
|
||||
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
|
||||
return value instanceof Array || nativeIsArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a boolean value.
|
||||
*
|
||||
@@ -1201,7 +1197,7 @@
|
||||
* // => true
|
||||
*/
|
||||
function isDate(value) {
|
||||
return value instanceof Date || toString.call(value) == dateClass;
|
||||
return value ? typeof value == 'object' && toString.call(value) == dateClass : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1648,7 +1644,7 @@
|
||||
* // => true
|
||||
*/
|
||||
function isRegExp(value) {
|
||||
return value instanceof RegExp || toString.call(value) == regexpClass;
|
||||
return value ? typeof value == 'object' && toString.call(value) == regexpClass : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4210,6 +4206,11 @@
|
||||
*
|
||||
* var lazyLayout = _.debounce(calculateLayout, 300);
|
||||
* jQuery(window).on('resize', lazyLayout);
|
||||
*
|
||||
* jQuery('.postbox').on('click', _.debounce(sendMail, 200, {
|
||||
* 'leading': true,
|
||||
* 'trailing': false
|
||||
* });
|
||||
*/
|
||||
function debounce(func, wait, options) {
|
||||
var args,
|
||||
@@ -4433,6 +4434,10 @@
|
||||
*
|
||||
* var throttled = _.throttle(updatePosition, 100);
|
||||
* jQuery(window).on('scroll', throttled);
|
||||
*
|
||||
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
|
||||
* 'trailing': false
|
||||
* }));
|
||||
*/
|
||||
function throttle(func, wait, options) {
|
||||
var args,
|
||||
|
||||
Reference in New Issue
Block a user