-
Notifications
You must be signed in to change notification settings - Fork 1
count
Subhajit Sahu edited this page Jun 13, 2020
·
17 revisions
Counts values which satisfy a test.
Alternatives: [count], [countAs].
set.count(x, fn, [ths]);
// x: a set
// fn: test function (v, v, x)
// ths: this argument
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