Use the first character when formatting the -_- like name sequences

This commit is contained in:
Wroclaw 2023-07-30 03:00:51 +02:00
parent 0e3962e110
commit 33a16bd629

View file

@ -72,8 +72,8 @@ function formatName(name: string): string {
.replace(/[^a-zA-Z0-9_-]/g, "_")
// remove trailing '-_' characters
.replace(/^[-_]+|[-_]+$/g, "")
// remove duplicated '-_' characters
.replace(/([-_])*/g, "$1");
// remove duplicated '-_' character sequences
.replace(/([-_])([-_])+/g, "$1");
}
/**