fix: handle numbers as well

This commit is contained in:
Jacob Kim 2025-08-05 17:47:07 -07:00
parent ea5859b3da
commit 404cce0047

View file

@ -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();
}