# array-indexofobject

> Like Array#indexOf but for objects used like hashes

Latest version **0.0.1** (published 2013-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-indexofobject
pnpm add array-indexofobject
yarn add array-indexofobject
bun add array-indexofobject
```

## 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.0.1 |
| Published | 2013-02-02 |
| First published | 2013-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Dan MacTough |
| Maintainers | danmactough |
| Keywords | utilities, array, object |

## Links

- npm: https://www.npmjs.com/package/array-indexofobject
- Repository: https://github.com/danmactough/node-array-indexofobject
- npm.io page: https://npm.io/package/array-indexofobject

## Recent versions

- 0.0.1 (latest) — 2013-02-02

## README

array-indexofobject
===================

Like Array#indexOf but for objects used like hashes

## Examples:

```js
    var arr = [];
    var obj = { a: 1, b: 2, c: 'a b c'};
    var obj2 = { a: 1, b: 2, c: 'a b c'}; // same key/value pairs
    arr.push(obj);
    arr.indexOf(obj); // 0
    arr.indexOf(obj2); // -1
    indexOfObject = require('array-indexofobject');
    indexOfObject(arr, obj); // 0
    indexOfObject(arr, obj2); // 0
```

By default, all properties in the object must match. Optionally, you can instead
pass one or more keys to use for comparison.

```js
    var arr = [];
    var obj = { a: 1, b: 2, c: 'a b c', d: 'something'};
    var obj2 = { a: 1, b: 2, c: 'a b c', d: 'this key is not important'};
    arr.push(obj);
    indexOfObject(arr, obj2); // -1
    indexOfObject(arr, obj2, 'a'); // 0
    indexOfObject(arr, obj2, ['a', 'b', 'c']); // 0
```

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