2024-10-17 21:31:23 +03:00

25 lines
589 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeLazy = void 0;
class LazyIterableIterator {
constructor(producer) {
this.producer = producer;
}
[Symbol.iterator]() {
if (this.it === undefined) {
this.it = this.producer();
}
return this.it;
}
next() {
if (this.it === undefined) {
this.it = this.producer();
}
return this.it.next();
}
}
function makeLazy(producer) {
return new LazyIterableIterator(producer);
}
exports.makeLazy = makeLazy;