New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

array-find-es6

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-find-es6

ES6 Array.find ponyfill. Return the first array element which satisfies a testing function.

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
470
increased by9.56%
Maintainers
1
Weekly downloads
 
Created
Source

array-find-es6

Fork of array-find to make it an ES6 type module.

Build Status

ES 2015 Array.find ponyfill.

Ponyfill: A polyfill that doesn't overwrite the native method.

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

Usage

import find from 'array-find-es6';
const numbers = [1, 2, 3, 4];

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

const robots = [{name: 'Flexo'}, {name: 'Bender'}, {name: 'Buster'}];

find(robots, function (robot, index, array) {
  return robot.name === 'Bender';
});
// => {name: 'Bender'}

find(robots, function (robot, index, array) {
  return robot.name === 'Fry';
});
// => undefined

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

Install

$ npm install array-find

License

MIT

Keywords

FAQs

Package last updated on 21 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc