UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

15 lines 423 B
import toIterator from './toIterator'; export function quantify(...args) { if (args.length === 1) return it => quantify(it, args[0]); const predicate = args[1]; let result = 0; const it = toIterator(args[0]); let next; while (!(next = it.next()).done) if (predicate(next.value)) result++; return result; } export default quantify; //# sourceMappingURL=quantify.js.map