MCPcopy Create free account
hub / github.com/Lemoncode/fonk / isIndex

Function isIndex

src/helpers/set.js:612–621  ·  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

610 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
611 */
612function isIndex(value, length) {
613 length = length == null ? MAX_SAFE_INTEGER : length;
614 return (
615 !!length &&
616 (typeof value == 'number' || reIsUint.test(value)) &&
617 value > -1 &&
618 value % 1 == 0 &&
619 value < length
620 );
621}
622
623/**
624 * Checks if `value` is a property name and not a property path.

Callers 1

baseSetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…