Skip to content

Find array elements. Executes a callback for each element, returns the first element for which its callback returns a truthy value.

Notifications You must be signed in to change notification settings

tjmehta/array-find

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

array-find

Find array elements. Executes a callback for each element, returns the first element for which its callback returns a truthy value.

Usage

var find = require('array-find');
var array = [1,2,3,4];

find(array, function (element, index, arr) {
  return element === 2;
});
// => 2

Optionally pass in an object as third argument to use as this when executing callback.

Install

$ npm install array-find

About

Find array elements. Executes a callback for each element, returns the first element for which its callback returns a truthy value.

Resources

Stars

Watchers

Forks

Packages

No packages published