UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

58 lines (28 loc) 964 B
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [arrayNormalizeNullishToEmpty](./rc-js-util.arraynormalizenullishtoempty.md) ## arrayNormalizeNullishToEmpty() function Replaces `null` / `undefined` with an empty `Array`<!-- -->. **Signature:** ```typescript export declare function arrayNormalizeNullishToEmpty<TItem>(array: TItem[] | null | undefined): TItem[]; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> array </td><td> TItem\[\] \| null \| undefined </td><td> </td></tr> </tbody></table> **Returns:** TItem\[\] `array` if it's an `Array` of length greater than 0, otherwise an empty `Array`<!-- -->. ## Remarks See [arrayNormalizeNullishToEmpty()](./rc-js-util.arraynormalizenullishtoempty.md)<!-- -->.