-
Notifications
You must be signed in to change notification settings - Fork 0
count
Subhajit Sahu edited this page Dec 28, 2022
·
14 revisions
Count values which satisfy a test.
function count(x, ft)
// x: ilists
// ft: test function (v, k, x)
const xilists = require('extra-ilists');
var x = [['a', 'b', 'c', 'd', 'e'], [1, 1, 2, 2, 4]];
xilists.count(x, v => v % 2 === 1);
// → 2
xilists.count(x, v => v % 2 === 0);
// → 3