Array.fromAsync
Less than 1 minute
Array.fromAsync
Module
Types
interface ArrayConstructor {
fromAsync<T, U>(
asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>,
mapfn?: (value: T, index: number) => U,
thisArg?: any
): Array<T>;
}
Entry points
core-js/proposals/array-from-async-stage-2
core-js(-pure)/full/array/from-async
Example
await Array.fromAsync(
(async function* () {
yield* [1, 2, 3];
})(),
(i) => i * i
); // => [1, 4, 9]