Minor fixes

This commit is contained in:
barsdeveloper
2022-04-25 18:51:23 +02:00
parent 4b563f023e
commit 1aa4ceb11c
8 changed files with 56 additions and 13 deletions

View File

@@ -169,6 +169,10 @@ export default class Utility {
* @param {String} value
*/
static formatStringName(value) {
return value.replaceAll(/\s+/g, " ").replaceAll(/(?<=[a-z])(?=[A-Z])|_/g, " ").trim()
return value
.trim()
.replaceAll(/\s+/g, " ") // Multiple spaces is just a single normal space
.replace(/^b/, "") // Remove leading b (for boolean values)
.replaceAll(/(?<=[a-z])(?=[A-Z])|_/g, " ") // Insert a space between
}
}