iteragain
Version:
Javascript Iterable/Iterator/Generator-function utilities.
18 lines • 547 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.quantify = quantify;
const toIterator_1 = require("./toIterator");
function quantify(...args) {
if (args.length === 1)
return it => quantify(it, args[0]);
const predicate = args[1];
let result = 0;
const it = (0, toIterator_1.default)(args[0]);
let next;
while (!(next = it.next()).done)
if (predicate(next.value))
result++;
return result;
}
exports.default = quantify;
//# sourceMappingURL=quantify.js.map