温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/globals/ArrayConstructor/fromAsync
点击访问原文链接

ArrayConstructor.fromAsync method | globals module | Bun

ArrayConstructor.fromAsync method | globals module | BunBuildDocsReferenceGuidesBlogDiscord/Globals/ArrayConstructor/fromAsyncMfromAsync

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Globals/ArrayConstructor/fromAsyncMfromAsync

method

ArrayConstructor.fromAsyncfromAsyncT>(iterableOrArrayLike: AsyncIterableT, any, any> | IterableT | PromiseLikeT>, any, any> | ArrayLikeT | PromiseLikeT>>): PromiseT[]>;

Creates an array from an async iterator or iterable object.

@param iterableOrArrayLike

An async iterator or array-like object to convert to an array.

fromAsyncT, U>(iterableOrArrayLike: AsyncIterableT, any, any> | IterableT, any, any> | ArrayLikeT>,mapFn: (value: AwaitedT>, index: number) => U,thisArg?: any): PromiseAwaitedU>[]>;

Creates an array from an async iterator or iterable object.

@param iterableOrArrayLike

An async iterator or array-like object to convert to an array.

@param thisArg

Value of 'this' used when executing mapfn.

fromAsyncT>(arrayLike: AsyncIterableT, any, any> | IterableT, any, any> | ArrayLikeT>): PromiseAwaitedT>[]>;

Create an array from an iterable or async iterable object. Values from the iterable are awaited.

await Array.fromAsync([1]); // [1]
await Array.fromAsync([Promise.resolve(1)]); // [1]
await Array.fromAsync((async function*() { yield 1 })()); // [1]
@param arrayLike

The iterable or async iterable to convert to an array.

@returns

A Promise whose fulfillment is a new Array instance containing the values from the iterator.

fromAsyncT, U>(arrayLike: AsyncIterableT, any, any> | IterableT, any, any> | ArrayLikeT>,mapFn?: (value: T, index: number) => U,thisArg?: any): PromiseAwaitedU>[]>;

Create an array from an iterable or async iterable object. Values from the iterable are awaited. Results of the map function are also awaited.

await Array.fromAsync([1]); // [1]
await Array.fromAsync([Promise.resolve(1)]); // [1]
await Array.fromAsync((async function*() { yield 1 })()); // [1]
await Array.fromAsync([1], (n) => n + 1); // [2]
await Array.fromAsync([1], (n) => Promise.resolve(n + 1)); // [2]
@param arrayLike

The iterable or async iterable to convert to an array.

@param mapFn

A mapper function that transforms each element of arrayLike after awaiting them.

@param thisArg

The this to which mapFn is bound.

@returns

A Promise whose fulfillment is a new Array instance containing the values from the iterator.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

ArrayConstructor.fromAsync method | globals module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method globals.ArrayConstructor.fromAsync | Bun