()
| 645 | } |
| 646 | |
| 647 | private async serialNext(): Promise<IteratorResult<T[]>> { |
| 648 | const batch: T[] = []; |
| 649 | while (batch.length < this.batchSize) { |
| 650 | const item = await this.upstream.next(); |
| 651 | if (item.done) { |
| 652 | if (this.enableSmallLastBatch && batch.length > 0) { |
| 653 | return {value: batch, done: false}; |
| 654 | } |
| 655 | return {value: null, done: true}; |
| 656 | } |
| 657 | batch.push(item.value); |
| 658 | } |
| 659 | return {value: batch, done: false}; |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | class FilterIterator<T> extends LazyIterator<T> { |