-
Notifications
You must be signed in to change notification settings - Fork 1
filterAt$
Subhajit Sahu edited this page Dec 5, 2022
·
12 revisions
Keep values at given keys.
Alternatives: filterAt, filterAt$.
Similar: map, reduce, filter, filterAt, reject, rejectAt.
function filterAt$(x, ks)
// x: a map (updated)
// ks: keys
const map = require('extra-map');
var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]);
map.filterAt$(x, ['a', 'c', 'e']);
// → Map(3) { 'a' => 1, 'c' => 3, 'e' => 5 }
x;
// → Map(3) { 'a' => 1, 'c' => 3, 'e' => 5 }
var x = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]);
map.filterAt$(x, ['b', 'd']);
// → Map(2) { 'b' => 2, 'd' => 4 }
- Data.List.filter: Haskell
- Array.prototype.filter: MDN web docs
- array_filter: PHP
- _.remove: lodash
- _.without: lodash
- _.compact: lodash
- _.pull: lodash
- _.pullAll: lodash
- _.pullAllBy: lodash
- _.pullAllWith: lodash
- Array.filter: sugarjs
- Array.exclude: sugarjs
- Array.compact: sugarjs
- array-tools.where: @75lb