fraxken / combine-async-iterators

Combine Asynchronous Iterators (no sequence)
MIT License
14 stars 4 forks source link

What is the best way to return child iterators? #10

Closed iambumblehead closed 1 year ago

iambumblehead commented 1 year ago

What is the best way to return child iterators?

I'm currently using this,

const sourcesreturn = () => sources.map(s => s.return());
const sourcescombined = Object.assign(combine(...sources), { sourcesreturn });

then, cleaning up this way,

sourcescombined.sourcesreturn();
sourcescombined.return();

But I notice child iterators are closed here in this package https://github.com/fraxken/combine-async-iterators/blob/master/index.js#L54

What is the best way to cleanup and return all streams?

fraxken commented 1 year ago

Hello 👋

Sorry missed your issue.

Not sure what do you want by return child iterators and return all streams. This package just combine multiple asynchronous iterators into one with no sequence (that's all, and yes no need to clear yourself).

I think the README example already cover everything required :)