1 /** Used as references for various `Number` constants. */
2 var MAX_SAFE_INTEGER = 9007199254740991;
5 * Checks if `value` is a valid array-like length.
7 * **Note:** This method is loosely based on
8 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
14 * @param {*} value The value to check.
15 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
21 * _.isLength(Number.MIN_VALUE);
24 * _.isLength(Infinity);
30 function isLength(value) {
31 return typeof value == 'number' &&
32 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
35 module.exports = isLength;