mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Expose _.isLength.
This commit is contained in:
committed by
John-David Dalton
parent
3d25b2fd9b
commit
7e726735ba
33
lodash.js
33
lodash.js
@@ -1122,19 +1122,6 @@
|
||||
return value > -1 && value % 1 == 0 && value < length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
*/
|
||||
function isLength(value) {
|
||||
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
|
||||
* character code is whitespace.
|
||||
@@ -1480,8 +1467,8 @@
|
||||
* `head`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`,
|
||||
* `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isDate`, `isElement`,
|
||||
* `isEmpty`, `isEqual`, `isEqualWith`, `isError`, `isFinite`, `isFunction`,
|
||||
* `isInteger`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
||||
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
||||
* `isInteger`, `isLength`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`,
|
||||
* `isNull`, `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
||||
* `isSafeInteger`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
|
||||
* `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `min`,
|
||||
* `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`,
|
||||
@@ -9318,6 +9305,21 @@
|
||||
return typeof value == 'number' && value == toInteger(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a valid array-like length.
|
||||
*
|
||||
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
*/
|
||||
function isLength(value) {
|
||||
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
||||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
@@ -13428,6 +13430,7 @@
|
||||
lodash.isFinite = isFinite;
|
||||
lodash.isFunction = isFunction;
|
||||
lodash.isInteger = isInteger;
|
||||
lodash.isLength = isLength;
|
||||
lodash.isMatch = isMatch;
|
||||
lodash.isMatchWith = isMatchWith;
|
||||
lodash.isNaN = isNaN;
|
||||
|
||||
Reference in New Issue
Block a user