Skip to content
/ find Public

Lookup an element in a list using a predicate

Notifications You must be signed in to change notification settings

micro-js/find

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find

Build status Git tag NPM version Code style

Lookup an element in a list using a predicate

Installation

$ npm install @f/find

Usage

var find = require('@f/find')


find(users, user => user.username === 'micro-js')

API

find(arr, fn, fromIndex)

  • arr - The array to search
  • fn - The predicate to use to search the array (accepts an item in the list and returns true/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.

License

MIT

About

Lookup an element in a list using a predicate

Resources

Stars

Watchers

Forks

Packages

No packages published