UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

22 lines 661 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TapIterator = void 0; /** Tap into the values of an iterator. `func` does not modify values passed to it as it's return value is unused. */ class TapIterator { constructor(iterator, func) { this.iterator = iterator; this.func = func; } [Symbol.iterator]() { return this; } next(...args) { const next = this.iterator.next(...args); if (!next.done) this.func(next.value); return next; } } exports.TapIterator = TapIterator; exports.default = TapIterator; //# sourceMappingURL=TapIterator.js.map