UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

15 lines (11 loc) 274 B
export function findIndex(predicate, list){ if (arguments.length === 1) return _list => findIndex(predicate, _list) const len = list.length let index = -1 while (++index < len){ if (predicate(list[ index ], index)){ return index } } return -1 }