designtopack/src/utils/string.js
2024-12-19 10:32:48 +01:00

15 lines
347 B
JavaScript

function toPascalCase(string) {
return string.replace(/\p{L}+/gu, function (w) {
return (
w[0].toLocaleUpperCase("fr-FR") + w.slice(1).toLocaleLowerCase("fr-FR")
);
});
}
function urlToPath(url) {
return url.replace(window.location.origin, "");
}
const StringUtils = { toPascalCase, urlToPath };
export default StringUtils;