Skip to main content

asArray() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Ensures that a given input is an array. If the input is a single item, it is converted to an array with a single entry.

Signature:

export declare function asArray<T>(arg?: T | T[] | any): (T | any)[]

Parameters

ParameterTypeDescription
argT | T[] | any

(Optional) a variable that needs to be converted to array

This API may change without a BREAKING CHANGE notice.

Returns:

(T | any)[]