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