tree: fa26224c502e27462bb46cb977515da70921b256 [path history] [tgz]
  1. .npmignore
  2. index.js
  3. LICENSE
  4. package.json
  5. README.md
  6. test.js
node_modules/indexes-of/README.md

indexes-of

like Array/String#indexOf but return all the indexes in an array.

var indexesOf = require('indexes-of')

var twosIndexes = indexesOf([1, 2, 3, 4, 5, 4, 3, 2, 1], 2)

console.log(twosIndexes)

// [1, 7]

Haiku

  • A 5 line module.
  • But the tests are 40 lines.
  • npm publish.

License

MIT