Last active
January 5, 2024 16:00
-
-
Save dtipson/c6e2ea388d29c23ff93b432a6c8257d5 to your computer and use it in GitHub Desktop.
Spreading out a generator of arrays into a generator of items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// spreadBatchesAsyncGen :: Iterator[[...Promises]] -> AsyncGenerator[[...Promises]] | |
const spreadBatchesAsyncGen = async function* (iterableOfPromises) { | |
for (let array of iterableOfPromises) { | |
yield* await Promise.all(array) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment