Skip to content

filterAt

Subhajit Sahu edited this page Jun 20, 2020 · 13 revisions

Keeps values at given indices only. 🏃 📼 📦 🌔 📒

Alternatives: [filter], [filterAt].
Similar: [map], [filter], [reject], [reduce], [accumulate].

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

Clone this wiki locally