UNPKG

imma

Version:

A collection of functions for dealing with native arrays and objects immutably

10 lines (9 loc) 295 B
'use strict' const findLastEntry = module.exports = (array, fn) => { for (let index = array.length - 1; index >= 0; index--) { // Skip sparse entries if (!(index in array)) continue const value = array[index] if (fn(value, index, array)) return [ index, value ] } }