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

interface ArrayConstructor | globals module | Bun

interface ArrayConstructor | globals module | BunBuildDocsReferenceGuidesBlogDiscord/Globals/ArrayConstructorP[Symbol.species]CoconstructorMfromMfromAsyncMisArrayMofPprototype

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Globals/ArrayConstructorP[Symbol.species]CoconstructorMfromMfromAsyncMisArrayMofPprototype

interface

ArrayConstructorinterface ArrayConstructorconstructor ArrayConstructor(arrayLength?: number): any[];constructor ArrayConstructorT>(arrayLength: number): T[];constructor ArrayConstructorT>(...items: T[]): T[];readonly [Symbol.species]: ArrayConstructorreadonly prototype: any[]fromT>(arrayLike: ArrayLikeT>): T[];

Creates an array from an array-like object.

@param arrayLike

An array-like object to convert to an array.

fromT, U>(arrayLike: ArrayLikeT>,mapfn: (v: T, k: number) => U,thisArg?: any): U[];

Creates an array from an iterable object.

@param arrayLike

An array-like object to convert to an array.

@param mapfn

A mapping function to call on every element of the array.

@param thisArg

Value of 'this' used to invoke the mapfn.

fromT>(iterable: IterableT, any, any> | ArrayLikeT>): T[];

Creates an array from an iterable object.

@param iterable

An iterable object to convert to an array.

fromT, U>(iterable: IterableT, any, any> | ArrayLikeT>,mapfn: (v: T, k: number) => U,thisArg?: any): U[];

Creates an array from an iterable object.

@param iterable

An iterable object to convert to an array.

@param mapfn

A mapping function to call on every element of the array.

@param thisArg

Value of 'this' used to invoke the mapfn.

fromAsyncT>(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.

isArray(arg: any): arg is any[];ofT>(...items: T[]): T[];

Returns a new array from a set of elements.

@param items

A set of elements to include in the new array object.

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 →

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

    API documentation for interface globals.ArrayConstructor | Bun