0.1.2 • Published 6 years ago
array-indicesof v0.1.2
array-indicesof
NOTE: array-indicesof was renamed to @extra-array/indices-of.
Get indices of all values in array equal to specified value, like Array.indexOf().
const indicesOf = require('array-indicesof');
// indicesOf(<array>, <search value>, [begin=0], [end], [target=[]], [at])
indicesOf(['r', 'o', 'b', 'o'], 'o');
// [1, 3]
indicesOf(['r', 'o', 'b', 'o'], 'o', 1);
// [1, 3]
indicesOf(['r', 'o', 'b', 'o'], 'o', 1, 3);
// [1]
indicesOf(['r', 'o', 'b', 'o'], 'o', 1, 3, [10, 11]);
// [10, 11, 1]
indicesOf(['r', 'o', 'b', 'o'], 'o', 1, 3, [10, 11], 1);
// [10, 1]