MCPcopy
hub / github.com/lodash/lodash / isIndex

Function isIndex

lodash.js:6355–6363  ·  view source on GitHub ↗

* Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.

(value, length)

Source from the content-addressed store, hash-verified

6353 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
6354 */
6355 function isIndex(value, length) {
6356 var type = typeof value;
6357 length = length == null ? MAX_SAFE_INTEGER : length;
6358
6359 return !!length &&
6360 (type == 'number' ||
6361 (type != 'symbol' && reIsUint.test(value))) &&
6362 (value > -1 && value % 1 == 0 && value < length);
6363 }
6364
6365 /**
6366 * Checks if the given arguments are from an iteratee call.

Callers 8

arrayLikeKeysFunction · 0.85
baseNthFunction · 0.85
basePullAtFunction · 0.85
baseSetFunction · 0.85
hasPathFunction · 0.85
isIterateeCallFunction · 0.85
reorderFunction · 0.85
lodash.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected