0.1.3 • Published 7 years ago
entries-findlast v0.1.3
entries-findlast
Get last value in entries that satisfies the test, like Array.find().
const findLast = require('entries-findlast');
// findLast(<entries>, <test function>, [this], [begin=0], [end])
findLast([5, 3, 9, 1, 1, 6].entries(), (v) => v>5);
// 6
findLast(new Set(['length', 'mass', 'time']).entries(), (v, i, ent) => i.includes('i'));
// 'time'
findLast(Object.entries({t: 20, i: 9, m: 13, e: 5}), (v, i, ent) => v<10);
// 5