UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

15 lines 520 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.consume = consume; const toIterator_1 = require("./toIterator"); function consume(...args) { var _a; if (!args.length || typeof args[0] === 'number') return it => consume(it, args[0]); const it = (0, toIterator_1.default)(args[0]); let n = (_a = args[1]) !== null && _a !== void 0 ? _a : Infinity; while (n-- > 0 && !it.next().done) ; } exports.default = consume; //# sourceMappingURL=consume.js.map