npm.io
1.0.0 • Published 6 years ago

find-last

Licence
MIT
Version
1.0.0
Deps
1
Size
3 kB
Vulns
0
Weekly
0
Stars
1

find-last Travis CI Build Status

Like Array#find but searches the array backwards.

NPM Badge

Install

npm install find-last

Usage

const findLast = require("find-last");

findLast(["a", "b", "bba", "cc", "d"], value => value.includes("a"));
//=> "bba"

API

findLast(array, predicate)
array

Type: array

The array to search.

predicate

Type: (item, index, array) => boolean

The predicate function to call on each item.

Keywords