1.1.8 • Published 5 years ago

@extra-object/find-key v1.1.8

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

Get index of first value in object that satisfies the test, like Array.findIndex().

const findIndex = require('@extra-object/find-key');
// findIndex(<object>, <test function>, [this])

findIndex({tesla: 'semi-truck', spacex: 'falcon 9'}, (v) => v.startsWith('falcon'));
// 'spacex'
findIndex({spacex: 'falcon 9', blueorigin: 'new shepard'}, (v, k) => k.indexOf('new')<0);
// 'spacex'
findIndex({pa1: 'LHC', pa2: 'KEKB', pa3: 'RHIC', pa4: 'Tevatron'}, (v, k, obj) => k==='pa'+Object.keys(obj).length);
// 'pa4'

extra-object

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago