0.1.7 • Published 6 years ago
iterable-indicesof v0.1.7
iterable-indicesof
NOTE: iterable-indicesof was renamed to @extra-iterable/indices-of.
Get indices of all values in iterable equal to specified value, like Array.indexOf().
const indicesOf = require('iterable-indicesof');
// indicesOf(<iterable>, <search value>, [begin=0], [end], [target=[]], [at])
indicesOf(new Set(['a', 'b', 'c']), 'c');
// [2]
indicesOf('cccc', 'c', 1);
// [1, 2, 3]
indicesOf('cccc', 'c', 1, 3);
// [1, 2]
indicesOf('cccc', 'c', 1, 3, [10, 11]);
// [10, 11, 1, 2]
indicesOf('cccc', 'c', 1, 3, [10, 11], 1);
// [10, 1, 2]