1.1.7 • Published 5 years ago
@extra-array/indices-of v1.1.7
Get indices of all values in array equal to specified value, like Array.indexOf().
const indicesOf = require('@extra-array/indices-of');
// 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]
With extra-array try
Array.indicesOf()
instead.