find-indices
Returns indexes of elements in an array that satisfy a predicate or a lodash iteratee shorthand.
Like lodash.findindex, but returns all indexes instead of the first one.
Install
npm install find-indices --save
API
find-indices
Parameters
array
Array The array to searchpredicate
(Function | Array | Object | string) The function invoked per iterationfromIndex
number The index to search from (optional, default0
)limit
number The maximum number of indexes to search (optional, default-1
)
Examples
; const coll = v: 0 v: 2 v: 0 v: 3 v: 3 ;; // [1, 3, 4]; // [0, 2]; // [3, 4]; // [1, 3, 4]