UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

17 lines 486 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nth = nth; const toIterator_1 = require("./toIterator"); function nth(...args) { if (args.length === 1) return (arg) => nth(arg, args[0]); const it = (0, toIterator_1.default)(args[0]); const index = args[1]; let i = 0; let next; while (!(next = it.next()).done && index !== i++) ; return next.value; } exports.default = nth; //# sourceMappingURL=nth.js.map