1.1.1 • Published 5 years ago
@extra-lists/find-all-indices v1.1.1
Get indices of all values in lists that satisfy the test, like Array.findIndex().
const findAllIndices = require('@extra-lists/find-all-indices');
// findAllIndices(<lists>, <test function>, [this])
a = ['syntax', 'description', 'examples'];
findAllIndices([a.keys(), a], (v) => v.includes('x'));
// [0, 2]
a = {t1: 'polyfill', t2: 'specifications', t3: 'compatibility'};
findAllIndices([Object.keys(a), Object.values(a)], (v, i, lst) => i.includes('2'));
// ['t2']