-
Notifications
You must be signed in to change notification settings - Fork 1
count
Subhajit Sahu edited this page Feb 3, 2021
·
24 revisions
Count values which satisfy a test.
function count(x, ft)
// x: an iterable
// ft: test function (v, i, x)
const xiterable = require('extra-iterable');
var x = [1, 1, 2, 2, 4];
xiterable.count(x, v => v % 2 === 1);
// → 2
xiterable.count(x, v => v % 2 === 0);
// → 3