Licence
MIT
Version
1.0.5
Deps
4
Size
18 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
These are array-handling functions that return indexes of items in the array.
Returns all indexes of value in array:
getIndexesOf(value, array); // value cannot be object.
Self-explanatory:
getLastIndexOf(value, array); // value cannot be object.
This returns all indexes of array items that pass the testFunction:
getIndexesThatPass(testFunction, array)
testFunction = function(currentValue [, currentIndex [, theArray]]){ ... } // must return boolean.
Example:
let arr = ['a', 'boy', 'is', 'playing', 'in', 'the', 'street'];
let stringsLongerThanThree = getIndexesThatPass((value) => value.length > 3, arr);
stringsLongerThanThree is now [3, 6]