Files
ospab.host/node_modules/fast-check/lib/esm/stream/LazyIterableIterator.js
2025-09-15 18:10:26 +03:00

21 lines
463 B
JavaScript

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();
}
}
export function makeLazy(producer) {
return new LazyIterableIterator(producer);
}