Skip to content
Subhajit Sahu edited this page Dec 22, 2022 · 14 revisions

Discard ientries which pass a test.

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


function reject(x, ft)
// x:  ientries
// ft: test function (v, k, x)
const ientries = require('extra-ientries');

var x = [["a", 1], ["b", 2], ["c", 3], ["d", 4], ["e", 5]];
[...ientries.reject(x, v => v % 2 === 1)];
// → [ [ "b", 2 ], [ "d", 4 ] ]

[...ientries.reject(x, v => v % 2 === 0)];
// → [ [ "a", 1 ], [ "c", 3 ], [ "e", 5 ] ]


References

Clone this wiki locally