1.1.1 • Published 5 years ago

@extra-lists/find-index v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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'

extra-lists