json-joy
Version:
Collection of libraries for building collaborative editing apps.
23 lines (22 loc) • 429 B
JavaScript
export class UndefEndIter {
i;
constructor(i) {
this.i = i;
}
next() {
const value = this.i();
return new IterRes(value, value === undefined);
}
[Symbol.iterator]() {
return this;
}
}
export class IterRes {
value;
done;
constructor(value, done) {
this.value = value;
this.done = done;
}
}
export const iter = (i) => new UndefEndIter(i);