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