-
Notifications
You must be signed in to change notification settings - Fork 1
count
Subhajit Sahu edited this page Dec 2, 2022
·
17 revisions
Count values which satisfy a test.
function count(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.count(x, v => v % 2 === 1);
// → 3
set.count(x, v => v % 2 === 0);
// → 2