designtopack/src/utils/string.js

16 lines
347 B
JavaScript
Raw Normal View History

2024-10-08 17:29:59 +02:00
function toPascalCase(string) {
return string.replace(/\p{L}+/gu, function (w) {
return (
w[0].toLocaleUpperCase("fr-FR") + w.slice(1).toLocaleLowerCase("fr-FR")
);
});
}
2024-12-19 10:32:48 +01:00
function urlToPath(url) {
return url.replace(window.location.origin, "");
}
const StringUtils = { toPascalCase, urlToPath };
export default StringUtils;