Skip to content
Subhajit Sahu edited this page Dec 2, 2022 · 17 revisions

Discard values which pass a test.

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


function reject(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.reject(x, v => v % 2 === 1);
// → Set(2) { 2, 4 }

set.reject(x, v => v % 2 === 0);
// → Set(3) { 1, 3, 5 }


References

Clone this wiki locally