Mfrom
Bun

method

ArrayConstructor.from

from<T>(
arrayLike: ArrayLike<T>
): T[];

Creates an array from an array-like object.

@param arrayLike

An array-like object to convert to an array.

from<T, U>(
arrayLike: ArrayLike<T>,
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.

from<T>(
iterable: Iterable<T, any, any> | ArrayLike<T>
): T[];

Creates an array from an iterable object.

@param iterable

An iterable object to convert to an array.

from<T, U>(
iterable: Iterable<T, any, any> | ArrayLike<T>,
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.