find-last-index
v1.0.0
Published
Like Array#findIndex but searches the array backwards.
Downloads
83
Readme
find-last-index
Like Array#findIndex but searches the array backwards.
Install
npm install find-last-index
Usage
const findLastIndex = require("find-last-index");
findLastIndex(["a", "b", "bba", "cc", "d"], value => value.includes("a"));
//=> 2
API
findLastIndex(array, predicate)
array
Type: array
The array to search.
predicate
Type: (item, index, array) => boolean
The predicate function to call on each item.