1.0.0 • Published 6 years ago

find-all-index v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

find-all-index

Find all indexes of a value in array and array of object.

Install

npm install find-all-index

Examples

Find all indexes from array of objects

const allIndexes = require('find-all-index');

let arr = [{key1:1, key2:"A1"},{key1:2, key2:"A2"},{key1:3, key2:"A3"},{key1:4, key2:"A2"}];

let indexes = allIndexes.findIndex(arr, 'A2', 'key2');
console.log(indexes);
// Will give [1,3]

Find all indexes from an array

const allIndexes = require('find-all-index');

let arr = [100,200,300,100];

let indexes = allIndexes.findIndex(arr, 100);
console.log(indexes);
// Will give [0,3]

MIT Licensed