mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-16 23:00:51 +00:00
refactor: Enhance toSnakeCase method to replace multiple underscores with a single underscore
This commit is contained in:
parent
8b41779fa2
commit
fdfabe080c
1 changed files with 2 additions and 1 deletions
|
|
@ -17,7 +17,8 @@ export class StringUtils {
|
|||
.replace(/([A-Z])/g, "_$1")
|
||||
.toLowerCase()
|
||||
.replace(/^_/, "")
|
||||
.replace(/[-\s]+/g, "_");
|
||||
.replace(/[-\s]+/g, "_")
|
||||
.replace(/_+/g, "_"); // Replace multiple underscores with single underscore
|
||||
}
|
||||
|
||||
static toKebabCase(str: string): string {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue