Fixed bug with the sluggify

This commit is contained in:
DrMint 2022-03-28 13:17:30 +02:00
parent 3a397d7eea
commit 575e81019a
1 changed files with 12 additions and 12 deletions

View File

@ -280,19 +280,19 @@ export function slugify(string: string | undefined): string {
return "";
}
return string
.replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/u, "a")
.replace(/[çÇ]/u, "c")
.replace(/[ðÐ]/u, "d")
.replace(/[ÈÉÊËéèêë]/u, "e")
.replace(/[ÏïÎîÍíÌì]/u, "i")
.replace(/[Ññ]/u, "n")
.replace(/[øØœŒÕõÔôÓóÒò]/u, "o")
.replace(/[ÜüÛûÚúÙù]/u, "u")
.replace(/[ŸÿÝý]/u, "y")
.replace(/[^a-z0-9- ]/iu, "")
.replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/g, "a")
.replace(/[çÇ]/gu, "c")
.replace(/[ðÐ]/gu, "d")
.replace(/[ÈÉÊËéèêë]/gu, "e")
.replace(/[ÏïÎîÍíÌì]/gu, "i")
.replace(/[Ññ]/gu, "n")
.replace(/[øØœŒÕõÔôÓóÒò]/gu, "o")
.replace(/[ÜüÛûÚúÙù]/gu, "u")
.replace(/[ŸÿÝý]/gu, "y")
.toLowerCase()
.replace(/[^a-z0-9- ]/gu, "")
.trim()
.replace(/ /iu, "-")
.toLowerCase();
.replace(/ /gu, "-");
}
export function randomInt(min: number, max: number) {