Checks if a Number is a RelativeIndex of an ArrayLike
A RelativeIndex can be negative
const result = isRelativeIndex(index)([1, 2, 3]);console.log(result); // true
Works with Strings, too
const result = isRelativeIndex(-5)("test");console.log(result); // false
true if the index is between -array.length and array.length, otherwise false
true
index
-array.length
array.length
false
Generated using TypeDoc
Checks if a Number is a RelativeIndex of an ArrayLike
Example
A RelativeIndex can be negative
Example
Works with Strings, too
Returns
trueif theindexis between-array.lengthandarray.length, otherwisefalse