@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
32 lines (30 loc) • 802 B
JavaScript
import { IterableX } from '../iterablex';
export class RepeatIterable extends IterableX {
constructor(source, count) {
super();
this._source = source;
this._count = count;
}
*[Symbol.iterator]() {
if (this._count === -1) {
while (1) {
for (const item of this._source) {
yield item;
}
}
}
else {
for (let i = 0; i < this._count; i++) {
for (const item of this._source) {
yield item;
}
}
}
}
}
export function repeat(count = -1) {
return function repeatOperatorFunction(source) {
return new RepeatIterable(source, count);
};
}
//# sourceMappingURL=repeat.mjs.map