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