Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-find-index

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-find-index

ES2015 `Array#findIndex()` ponyfill

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9M
decreased by-21.52%
Maintainers
1
Weekly downloads
 
Created

What is array-find-index?

The array-find-index npm package provides a simple utility to find the index of the first element in an array that satisfies a provided testing function. It is a lightweight and straightforward alternative to the native Array.prototype.findIndex method, particularly useful in environments where polyfills are not available or desired.

What are array-find-index's main functionalities?

Find Index of First Matching Element

This feature allows you to find the index of the first element in an array that satisfies the provided testing function. In this example, the function isLargeNumber checks if an element is greater than 13, and findIndex returns the index of the first element that meets this condition.

const findIndex = require('array-find-index');
const array = [5, 12, 8, 130, 44];
const isLargeNumber = (element) => element > 13;
const index = findIndex(array, isLargeNumber);
console.log(index); // Output: 3

Other packages similar to array-find-index

Keywords

FAQs

Package last updated on 30 Sep 2016

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