JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q69616F
  • License MIT

Get indices of all values in array that satisfy the test, like Array.findIndex().

Package Exports

  • @extra-array/find-all-indices

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@extra-array/find-all-indices) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Get indices of all values in array that satisfy the test, like Array.findIndex().

const findAllIndices = require('@extra-array/find-all-indices');
// findAllIndices(<array>, <test function>, [this], [begin=0], [end], [target=[]], [at])
// - <test function>(<value>, <index>, <array>)

findAllIndices(['a', 'b', 'cd'], (v) => v>'b');
// [2]
findAllIndices(['a', 'b', 'c', 'd'], (v, i, arr) => v>'b', null, 1);
// [2, 3]
findAllIndices(['a', 'b', 'c', 'd'], (v, i, arr) => v>'b', null, 1, 3);
// [2]
findAllIndices(['a', 'b', 'c', 'd'], (v, i, arr) => v>'b', null, 1, 3, [10, 11]);
// [10, 11, 2]
findAllIndices(['a', 'b', 'c', 'd'], (v, i, arr) => v>'b', null, 1, 3, [10, 11], 1);
// [10, 2]

With extra-array try Array.findAllIndices() instead.

extra-array