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.
15 lines • 412 B
JavaScript
/**
* @public
* Replaces `null` / `undefined` with an empty `Array`.
* @returns `array` if it's an `Array` of length greater than 0, otherwise an empty `Array`.
*
* @remarks
* See {@link arrayNormalizeNullishToEmpty}.
*/
export function arrayNormalizeNullishToEmpty(array) {
if (array == null) {
return [];
}
return array;
}
//# sourceMappingURL=array-normalize-nullish-to-empty.js.map