Lookup an element in a list using a predicate
$ npm install @f/find
var find = require('@f/find')
find(users, user => user.username === 'micro-js')
arr
- The array to searchfn
- The predicate to use to search the array (accepts an item in the list and returnstrue/false
).fromIndex
- Optional, starting index. Defaults to zero.
Returns: Either the first element within arr
for which fn
returns true, or null
if none is found.
MIT