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.
17 lines (16 loc) • 407 B
text/typescript
/**
* @public
* Replaces `null` / `undefined` with an empty `string`.
* @returns `input` if it's a `string` of length greater than 0, otherwise an empty `string`.
*
* @remarks
* See {@link stringNormalizeNullUndefinedToEmpty}.
*/
export function stringNormalizeNullUndefinedToEmpty(input: string | null | undefined): string
{
if (input == null)
{
return "";
}
return input;
}