npm.io
2.10.19 • Published 4 years ago

@extra-array/filter-at

Licence
MIT
Version
2.10.19
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
17

Keeps values at given indices only.

Alternatives: filter, filter$, filterAt.
Similar: map, filter, reject, reduce, accumulate.

This is part of package extra-array.


array.filterAt(x, is);
// x:  an array (updated)
// is: indices (sorted)
// → x
const array = require("extra-array");

var x = [2, 4, 6, 8];
array.filterAt(x, [1, 2]);
// [ 4, 6 ]

array.filterAt(x, [1, 3]);
// [ 4, 8 ]


References