Starting in Node 10.3, you can have async for...of loops
async function() {
for await (const item of interable) {
}
}
and in Node 8, we could still use an iterator to return promises to for...of
async function foo() {
for (const _item of iterable) {
const item = await _item;
}
}
It would be a good idea to add a Symbol.iterator method to our cursors to allow them to be used in for...of loops
- is related to
-
NODE-1472 Inconsistent Cursor.map() Behavior with asyncIterator on Streams
-
- Closed
-