array.js 225 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 export function findIndex ( array, fn ) { for ( let i = 0; i < array.length; i += 1 ) { if ( fn( array[i], i ) ) return i; } return -1; } export function find ( array, fn ) { return array[ findIndex( array, fn ) ]; }