UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

17 lines 455 B
/** Repeats `value` a certain number of times. */ export class RepeatIterator { constructor(value, times) { this.value = value; this.times = times; } [Symbol.iterator]() { return this; } next() { if (this.times-- > 0) return { done: false, value: this.value }; return { done: true, value: undefined }; } } export default RepeatIterator; //# sourceMappingURL=RepeatIterator.js.map