Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tuple.fromAsync? #385

Open
js-choi opened this issue Dec 2, 2023 · 0 comments
Open

Tuple.fromAsync? #385

js-choi opened this issue Dec 2, 2023 · 0 comments

Comments

@js-choi
Copy link

js-choi commented Dec 2, 2023

This proposal’s spec defines a Tuple.from method akin to Array.from. #250 (see #369) also added support for proposal-iterator-helpers’s Iterator.from and proposal-async-iterator-helpers’s AsyncIterator.from. proposal-iterator-helpers is at Stage 3 and proposal-async-iterator-helpers is at Stage 2.

proposal-array-from-async is also at Stage 3 (conditional on editor review). Its Array.fromAsync is meant to coexist with AsyncIterator.from like how Array.from coexists with Iterator.from.

Should this proposal add a parallel Tuple.fromAsync?

let tup = #[];
for await (const v of asyncIter) {
  tup = #[ ...tup, v ];
}
let tup = await Tuple.fromAsync(asyncIter);
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant