-
Notifications
You must be signed in to change notification settings - Fork 1
reject
Subhajit Sahu edited this page Feb 3, 2021
·
11 revisions
Discard the values which pass a test.
Alternatives: reject, rejectAt.
Similar: map, filter, reject, reduce, accumulate.
function reject(x, ft)
// x: an iterable
// ft: test function (v, i, x)
const xiterable = require('extra-iterable');
var x = [1, 2, 3, 4, 5];
[...xiterable.reject(x, v => v % 2 === 1)];
// → [2, 4]
[...xiterable.reject(x, v => v % 2 === 0)];
// → [1, 3, 5]