scramjetorg/scramjet

Async iterators should work in flatMap

MichalCz opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
flatMap is a powerfull function, but should support async iteration.

There may be additional methods needing this.

Describe the solution you'd like

This simple example should not error:

DataStream.from(generator1)
    .flatMap(async function*(chunk) { yield* await chunk.items(); })
  • Methods needing attention:
    flatMap, flatten (on DataStream<AsyncIterator>), join
  • Additionally pretty much all of MultiStream should be reviewed to work with iterators.
  • Docs need to be updated - add more about generators.
  • Primary example on webpage and in repo should be updated with generators.

Yup. Now works.