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.
22 lines • 671 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringNormalizeEmptyToUndefined = void 0;
/**
* @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}.
*/
function stringNormalizeEmptyToUndefined(input) {
if (input == null) {
return undefined;
}
if (input.length === 0) {
return undefined;
}
return input;
}
exports.stringNormalizeEmptyToUndefined = stringNormalizeEmptyToUndefined;
//# sourceMappingURL=string-normalize-empty-to-undefined.js.map