0.1.11 • Published 6 years ago
iterable-find v0.1.11
iterable-find
NOTE: iterable-find was renamed to @extra-iterable/find.
Get first value in iterable that satisfies the test, like Array.find().
const find = require('iterable-find');
// find(<iterable>, <test function>, [this], [begin=0], [end])
// - <test function>(<value>, <index>, <iterable>)
find(new Set(['a', 'b', 'cd']), (v) => v>'b');
// 'cd'
find(['a', 'b', 'cd'], (v, i, itr) => v>'b', null, 1);
// 'cd'
find(['a', 'b', 'cd'], (v, i, itr) => v>'b', null, 1, 2);
// undefined