fix: handle numbers as well
This commit is contained in:
parent
ea5859b3da
commit
404cce0047
1 changed files with 1 additions and 1 deletions
|
|
@ -40,7 +40,7 @@ export function escapeForSVG(text: string): string {
|
|||
|
||||
export function kebabOfStr(str: string): string {
|
||||
return str
|
||||
.replace(/([a-z])([A-Z])/g, "$1-$2") // handle camelCase and PascalCase
|
||||
.replace(/([a-z0-9])([A-Z])/g, "$1-$2") // handle camelCase, PascalCase, and numbers followed by uppercase
|
||||
.replace(/[\s_]+/g, "-") // replace spaces and underscores with hyphens
|
||||
.toLowerCase();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue