js-util

Home > rc-js-util > arrayNormalizeNullishToEmpty

arrayNormalizeNullishToEmpty() function

Replaces null / undefined with an empty Array.

Signature:

export declare function arrayNormalizeNullishToEmpty<TItem>(array: TItem[] | null | undefined): TItem[];

Parameters

Parameter Type Description
array TItem[] | null | undefined  

Returns:

TItem[]

array if it’s an Array of length greater than 0, otherwise an empty Array.

Remarks

See arrayNormalizeNullishToEmpty().