mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
15 lines
325 B
TypeScript
15 lines
325 B
TypeScript
export const slugify = (text: string) => {
|
|
return text
|
|
.toString()
|
|
.normalize("NFKD")
|
|
.replace(/[\u0300-\u036f]/g, "")
|
|
.toLowerCase()
|
|
.trim()
|
|
.replace(/\_/g, "-")
|
|
.replace(/\s+/g, "-")
|
|
.replace(/[^\w\-]+/g, "")
|
|
.replace(/\-\-+/g, "-")
|
|
.replace(/^-+/, "")
|
|
.replace(/-+$/, "");
|
|
};
|