Creates an array from an array-like object.
Search the reference...
/
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[];An array-like object to convert to an array.
Creates an array from an iterable object.
An array-like object to convert to an array.
A mapping function to call on every element of the array.
Value of 'this' used to invoke the mapfn.
Creates an array from an iterable object.
An iterable object to convert to an array.
Creates an array from an iterable object.
An iterable object to convert to an array.
A mapping function to call on every element of the array.
Value of 'this' used to invoke the mapfn.
Creates an array from an async iterator or iterable object.
An async iterator or array-like object to convert to an array.
Creates an array from an async iterator or iterable object.
An async iterator or array-like object to convert to an array.
Value of 'this' used when executing mapfn.
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]
The iterable or async iterable to convert to an array.
A Promise whose fulfillment is a new Array instance containing the values from the iterator.
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]
The iterable or async iterable to convert to an array.
A mapper function that transforms each element of arrayLike after awaiting them.
The this to which mapFn is bound.
A Promise whose fulfillment is a new Array instance containing the values from the iterator.
Returns a new array from a set of elements.
A set of elements to include in the new array object.
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →interface ArrayConstructor | globals module | Bun,AI智能索引,全网链接索引,智能导航,网页索引
- API documentation for interface globals.ArrayConstructor | Bun