()
| 1171 | } |
| 1172 | |
| 1173 | async serialNext(): Promise<IteratorResult<T>> { |
| 1174 | // TODO(soergel): consider performance |
| 1175 | if (!this.upstreamExhausted) { |
| 1176 | this.refill(); |
| 1177 | } |
| 1178 | while (!this.buffer.isEmpty()) { |
| 1179 | const chosenIndex = this.chooseIndex(); |
| 1180 | const result = await this.buffer.shuffleExcise(chosenIndex); |
| 1181 | if (result.done) { |
| 1182 | this.upstreamExhausted = true; |
| 1183 | } else { |
| 1184 | this.refill(); |
| 1185 | return result; |
| 1186 | } |
| 1187 | } |
| 1188 | return {value: null, done: true}; |
| 1189 | } |
| 1190 | } |
no test coverage detected