getArray()function

getArray(list: unknown): ImmutableArray<unknown> | undefined
ParamType
listunknown
The value to convert (an array is returned as-is, an iterable is collected into a new array). required
Return
ImmutableArray<unknown> | undefined
An array of the items, or undefined if list could not be converted.

Convert a possible array to an array.

Examples

getArray(new Set([1, 2])); // [1, 2]
getArray(123); // undefined