@bemoje/arr-indexes-of
v1.0.3
Published
Returns all indexes at which an element is found.
Downloads
3
Maintainers
Readme
@bemoje/arr-indexes-of
Returns all indexes at which an element is found.
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/arr-indexes-of
npm install --save @bemoje/arr-indexes-of
npm install --save-dev @bemoje/arr-indexes-of
Usage
import arrIndexesOf from '@bemoje/arr-indexes-of'
const arr = ['a', 'b', 'c', 'a']
arrIndexesOf(arr, 'a')
//=> [0, 3]
arrIndexesOf(arr, 'b')
//=> [1]
arrIndexesOf(arr, 'd')
//=> []
Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
API
arrIndexesOf
Returns
all indexes at which an element is found.
Parameters
arr
Array The array to searchelement
any The element to find