array-indexofobject
Like Array#indexOf but for objects used like hashes
Examples:
var arr = [];
var obj = { a: 1, b: 2, c: 'a b c'};
var obj2 = { a: 1, b: 2, c: 'a b c'};
arr.push(obj);
arr.indexOf(obj);
arr.indexOf(obj2);
indexOfObject = require('array-indexofobject');
indexOfObject(arr, obj);
indexOfObject(arr, obj2);
By default, all properties in the object must match. Optionally, you can instead
pass one or more keys to use for comparison.
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);
indexOfObject(arr, obj2, 'a');
indexOfObject(arr, obj2, ['a', 'b', 'c']);