UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

14 lines (10 loc) 269 B
export function findLast(predicate, list){ if (arguments.length === 1) return _list => findLast(predicate, _list) let index = list.length while (--index >= 0){ if (predicate(list[ index ], index)){ return list[ index ] } } return undefined }