@t7/utils
Version:
Utility methods for T7 components.
39 lines (25 loc) • 588 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ = require("./");
// Dependencies.
/*
Helper to format alphanumeric strings.
BEFORE:
- "A!@#$%^&*()_+9"
AFTER:
- "A9"
*/
var formatAlphanumeric = function formatAlphanumeric(value) {
// Early exit.
if (!(0, _.exists)(value)) {
return '';
} // To string.
value = String(value); // Format.
value = value.replace(/[^A-Z0-9]/gi, ''); // Expose string.
return value;
}; // Export.
var _default = formatAlphanumeric;
exports.default = _default;
;