MCPcopy Create free account
hub / github.com/dunky11/react-saas-template / isIndex

Function isIndex

src/shared/functions/toArray.js:542–549  ·  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

540 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
541 */
542function isIndex(value, length) {
543 length = length == null ? MAX_SAFE_INTEGER : length;
544 return (
545 !!length &&
546 (typeof value === "number" || reIsUint.test(value)) &&
547 (value > -1 && value % 1 === 0 && value < length)
548 );
549}
550
551/**
552 * Checks if `func` has its source masked.

Callers 1

arrayLikeKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected