const pascalCase = (string) => {
function toPascalCase(string) {
return `${string}`
.replace(new RegExp(/[-_]+/, "g"), " ")
.replace(new RegExp(/[^ws]/, "g"), "")
.replace(
new RegExp(/s+(.)(w*)/, "g"),
($1, $2, $3) => `${$2.toUpperCase() + $3.toLowerCase()}`
)
.replace(new RegExp(/w/), (s) => s.toUpperCase());
}
const newText = toPascalCase(string);
return newText
};