# index-of

> Get the index of the first element in an array that returns truthy for the given value, using strict equality for comparisons.

Latest version **0.2.0** (published 2015-06-23) · MIT license · 0 weekly downloads

> **Native alternative:** Array.prototype.indexOf — Use native JavaScript (Node 0.10.0+) (https://developer.mozilla.orgGlobal_Objects/Array/indexOf)

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-06-23 |
| First published | 2014-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | array, index, index-of, javascript, js, util, utils |

## Links

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

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-06-23
- 0.1.1 — 2015-05-08
- 0.1.0 — 2014-12-12

## README

# index-of [![NPM version](https://badge.fury.io/js/index-of.svg)](http://badge.fury.io/js/index-of)

> Get the index of the first element in an array that returns truthy for the given value, using strict equality for comparisons.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i index-of --save
```

Install with [bower](http://bower.io/)

```sh
$ bower install index-of --save
```

## Usage

```js
var indexOf = require('index-of');

indexOf(['a', 'b', 'c'], 'b');
//=> 1

indexOf(['a', 'b', 'c'], 'd');
//=> -1

indexOf(['a', 'b', 'c', 'a', 'b', 'c'], 'b', 2);
//=> 4
```

## Related projects

Other object utils:

* [array-every](https://github.com/jonschlinkert/array-every): Returns true if the callback returns truthy for all elements in the given array.
* [array-slice](https://github.com/jonschlinkert/array-slice): Array-slice method. Slices `array` from the `start` index up to, but not including, the `end`… [more](https://github.com/jonschlinkert/array-slice)
* [array-unique](https://github.com/jonschlinkert/array-unique): Return an array free of duplicate values. Fastest ES5 implementation.
* [filter-array](https://github.com/jonschlinkert/filter-array): Iterates over the elements in an array, returning an array with only the elements for… [more](https://github.com/jonschlinkert/filter-array)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/index-of/issues/new)

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 22, 2015._

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