Hard
What's missing in this custom iterator implementation that uses generators to process a large dataset in chunks?
1class DatasetProcessor {2 constructor(dataset, chunkSize = 1000) {3 this.dataset = dataset;4 this.chunkSize = chunkSize;5 }67 *chunkGenerator() {8 ______________________________9 ______________________________10 ______________________________11 }1213 async processChunks(processor) {14 for (const chunk of this.chunkGenerator()) {15 await processor(chunk);16 console.log(`Processed chunk of ${chunk.length} items`);17 }18 }19}2021const processor = new DatasetProcessor([/* large dataset */]);22processor.processChunks(async chunk => {23 // Process each chunk24 const results = await Promise.all(25 chunk.map(item => fetch(`/api/process/${item.id}`))26 );27});