Closed js-choi closed 3 years ago
I think both should exist, too. One reason is that they’re not quite equivalent: Array.fromAsync
will work with any object implementing the async iterable contract regardless of whether it inherits from AsyncIteratorPrototype.
See tc39/proposal-iterator-helpers#156.
The exciting iterator-helpers proposal has a similar
toArray
method that overlaps with this. (toArray
already overlaps withArray.from
too.) See #1.My preference is to keep both
toArray
andArray.fromAsync
(Array.from
being a fait accompli). But we can explore this more before both proposals advance further. CC: @codehag