Spread async with some looking for champion

Looking for opinions and champions

1 Like

[...await x] is already valid syntax. [await ...x] was mentioned in the issue you linked and is not valid syntax, so using that would probably be ideal.

1 Like

It throws errors in combination with generators. Should it be already supported in node v13?

Hello Misiur,
thank you for your idea!

Notice that the iterator-helpers proposal already covers this use case:

const values = await gen().toArray();
const somevalues = await gen().take(2).toArray();

No need to strain spread syntax.

2 Likes

Awesome, rxjs integration with lazy evaluation sounds awesome, but still, spread syntax support would be great.

I like this idea a lot (mod @devsnek's nit, of course). Makes some things trivial like reading a stream into a buffer (with Buffer.from([await ...x])) and getting the last N items in a stream (with [await ...takeLast(n, x)]).

Reflected the await position change.