Skip to content

filterAt

Subhajit Sahu edited this page Dec 22, 2022 · 15 revisions

Keep entries with given keys.

Similar: map, reduce, filter, filterAt, reject, rejectAt.


function filterAt(x, ks)
// x:  entries
// ks: keys
const entries = require('extra-entries');

var x = [["a", 1], ["b", 2], ["c", 3], ["d", 4], ["e", 5]];
[...entries.filterAt(x, ["a", "c", "e"])];
// → [ [ "a", 1 ], [ "c", 3 ], [ "e", 5 ] ]

[...entries.filterAt(x, ["b", "d"])];
// → [ [ "b", 2 ], [ "d", 4 ] ]


References

Clone this wiki locally