Home > rc-js-util > arrayNormalizeNullishToEmpty
Replaces null
/ undefined
with an empty Array
.
Signature:
export declare function arrayNormalizeNullishToEmpty<TItem>(array: TItem[] | null | undefined): TItem[];
Parameter | Type | Description |
---|---|---|
array | TItem[] | null | undefined |
Returns:
TItem[]
array
if it’s an Array
of length greater than 0, otherwise an empty Array
.