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.
16 lines (15 loc) • 334 B
text/typescript
/**
* @public
* Normalizes `null` input to `undefined`.
*
* @remarks
* See {@link fpNormalizeToUndefined}.
*/
export function fpNormalizeToUndefined<TValue>(value: TValue): Exclude<TValue, null> | undefined
{
if (value === null)
{
return undefined;
}
return value as Exclude<TValue, null> | undefined;
}