1.0.0 • Published 8 years ago

@f/find v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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