iteragain
Version:
Javascript Iterable/Iterator/Generator-function utilities.
19 lines • 620 B
JavaScript
/** Repeats `value` a certain number of times. */
var RepeatIterator = /** @class */ (function () {
function RepeatIterator(value, times) {
this.value = value;
this.times = times;
}
RepeatIterator.prototype[Symbol.iterator] = function () {
return this;
};
RepeatIterator.prototype.next = function () {
if (this.times-- > 0)
return { done: false, value: this.value };
return { done: true, value: undefined };
};
return RepeatIterator;
}());
export { RepeatIterator };
export default RepeatIterator;
//# sourceMappingURL=RepeatIterator.js.map