* Collect all elements of this dataset into an array with prefetching 100 * elements. This is useful for testing, because the prefetch changes the * order in which the Promises are resolved along the processing pipeline. * This may help expose bugs where results are dependent on the order o
()
| 192 | * when the stream is exhausted. |
| 193 | */ |
| 194 | async toArrayForTest(): Promise<T[]> { |
| 195 | const stream = this.prefetch(100); |
| 196 | const result: T[] = []; |
| 197 | let x = await stream.next(); |
| 198 | while (!x.done) { |
| 199 | result.push(x.value); |
| 200 | x = await stream.next(); |
| 201 | } |
| 202 | return result; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Draw items from the stream until it is exhausted. |