@patchworkdev/common
Version:
Patchwork Development Kit
10 lines (9 loc) • 451 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanAndCapitalizeFirstLetter = cleanAndCapitalizeFirstLetter;
function cleanAndCapitalizeFirstLetter(string) {
// Remove non-alphanumeric characters and whitespace
const cleanedString = string.replace(/[^a-zA-Z0-9]/g, '');
// Capitalize the first letter of the cleaned string
return cleanedString.charAt(0).toUpperCase() + cleanedString.slice(1);
}