Skip to content

filterAt

Subhajit Sahu edited this page May 3, 2023 · 13 revisions

Keep values at given indices.

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


function filterAt(x, is)
// x:  an array
// is: indices
const xarray = require('extra-array');

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

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


References

Clone this wiki locally