Array.fromAsync
小于 1 分钟
Array.fromAsync
模块
类型
interface ArrayConstructor {
fromAsync<T, U>(
asyncItems: AsyncIterable<T> | Iterable<T> | ArrayLike<T>,
mapfn?: (value: T, index: number) => U,
thisArg?: any
): Array<T>;
}
入口点
core-js/proposals/array-from-async-stage-2
core-js(-pure)/full/array/from-async
示例
示例:
await Array.fromAsync(
(async function* () {
yield* [1, 2, 3];
})(),
(i) => i * i
); // => [1, 4, 9]