filterAt (original) (raw)

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