@extra-array/find-indices
v2.9.12
Published
Finds indices of values passing a test.
Downloads
356
Maintainers
Readme
Finds indices of values passing a test. :running: :vhs: :package: :moon: :ledger:
Alternatives: findIndex, findIndices. Similar: find, findIndex. This is part of package extra-array.
array.findIndices(x, fn);
// x: an array
// fn: test function (v, i, x)
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.findIndices(x, v => v % 2 == 0);
// [ 1, 3 ] ^ ^
array.findIndices(x, v => v % 2 == 1);
// [ 0, 2, 4 ] ^ ^