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