# find-index

> finds an item in an array matching a predicate function, and returns its index

Latest version **1.1.1** (published 2019-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install find-index
pnpm add find-index
yarn add find-index
bun add find-index
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-02-12 |
| First published | 2014-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | James Friend |
| Maintainers | jsdf |
| Keywords | array, findindex, es6, es2015, ponyfill, polyfill, find |

## Links

- npm: https://www.npmjs.com/package/find-index
- Repository: https://github.com/jsdf/find-index
- Issues: https://github.com/jsdf/find-index/issues
- npm.io page: https://npm.io/package/find-index

## Recent versions

- 1.1.1 (latest) — 2019-02-12
- 1.1.0 — 2015-05-14
- 1.0.1 — 2015-05-14
- 1.0.0 — 2015-05-13
- 0.1.1 — 2014-06-29
- 0.1.0 — 2014-06-29

## README

# find-index

An implementation of the ES6 method `Array.prototype.findIndex` as a standalone module and a 
[*ponyfill*](https://ponyfill.com).

Finds an item in an array matching a predicate function, and returns its index.

Fast both when `thisArg` is used and also when it isn't.

### usage

```bash
npm install find-index
```

```js
var findIndex = require('find-index/findIndex')
var findIndex = require('find-index/ponyfill') // will use native Array#findIndex if available.
var findLastIndex = require('find-index/findLastIndex') // search backwards from end
```
    findIndex(array, callback[, thisArg])
    findLastIndex(array, callback[, thisArg])
    Parameters:
      array
        The array to operate on.
      callback
        Function to execute on each value in the array, taking three arguments:
          element
            The current element being processed in the array.
          index
            The index of the current element being processed in the array.
          array
            The array findIndex was called upon.
      thisArg
        Object to use as this when executing callback.

Based on [array-findindex](https://www.npmjs.org/package/array-findindex)

### performance

```bash
$ iojs --harmony_arrays perf/benchmark.js

native Array.prototype.findIndex: 6347ms
findIndex: 1633ms
findIndex ponyfill: 6384ms
findLastIndex: 1508ms
npm lodash.findindex: 2900ms
npm array-findindex: 3512ms
```

---
_Source: https://npm.io/package/find-index · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
