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