1.1.1 • Published 6 years ago
@extra-lists/find-last v1.1.1
Get last value in lists that satisfies the test, like Array.find().
const findLast = require('@extra-lists/find-last');
// findLast(<lists>, <test function>, [this])
a = ['edge', 'opera', 'chrome'];
findLast([a.keys(), a], (v) => v.includes('r'));
// 'chrome'
a = {s1: 'bing', s2: 'duckduckgo', s3: 'google'};
findLast([Object.keys(a), Object.values(a)], (v, i, lst) => v.length>4);
// 'google'