-
Notifications
You must be signed in to change notification settings - Fork 1
filterAt
Subhajit Sahu edited this page Feb 3, 2021
·
10 revisions
Keep the values at given indices.
Alternatives: filter, filterAt.
Similar: map, filter, reject, reduce, accumulate.
function filterAt(x, is)
// x: an iterable
// is: indices (sorted)
const xiterable = require('extra-iterable');
var x = [2, 4, 6, 8];
[...xiterable.filterAt(x, [1, 2])];
// → [4, 6]
[...xiterable.filterAt(x, [1, 3])];
// → [4, 8]