0.1.6 • Published 7 years ago
entries-find v0.1.6
entries-find
NOTE: entries-find was renamed to @extra-entries/find.
Get first value in entries that satisfies the test, like Array.find().
const find = require('entries-find');
// find(<entries>, <test function>, [this], [begin=0], [end])
// - <test function>(<value>, <key>, <entries>)
// -> <first value>
find([5, 3, 9, 1, 1, 6].entries(), (v) => v>5);
// 9
find(new Set(['length', 'mass', 'time']).entries(), (v, k, ent) => k.includes('i'));
// 'time'
find(Object.entries({t: 20, i: 9, m: 13, e: 5}), (v, k, ent) => v<10);
// 9