-
Notifications
You must be signed in to change notification settings - Fork 1
filter
Subhajit Sahu edited this page Dec 2, 2022
·
17 revisions
Keep values which pass a test.
Alternatives: filter, filter$.
Similar: map, reduce, filter, filterAt, reject, rejectAt.
function filter(x, ft)
// x: a set
// ft: test function (v, v, x)
const set = require('extra-set');
var x = new Set([1, 2, 3, 4, 5]);
set.filter(x, v => v % 2 === 1);
// → Set(3) { 1, 3, 5 }
set.filter(x, v => v % 2 === 0);
// → Set(2) { 2, 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