Suppose I have an async function * ()
(setup here) like this:
const f = async function * () {
yield * [ 1, 2, 3 ];
};
I can gather the results like this:
const xs = [];
for await (const x of f()) {
xs.push(x);
}
But can I use the ...
syntax to make this more compact?
Something like:
const xs = await f(); // xs = [ 1, 2, 3 ]