Bump reva deps (#8412)

* bump dependencies

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* bump reva and add config options

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-02-21 10:20:36 +01:00
committed by GitHub
parent c92ebf4b46
commit 5ed57cc09a
490 changed files with 19128 additions and 11161 deletions
+7 -4
View File
@@ -1,10 +1,13 @@
package strcase
var uppercaseAcronym = map[string]string{
"ID": "id",
}
import (
"sync"
)
var uppercaseAcronym = sync.Map{}
//"ID": "id",
// ConfigureAcronym allows you to add additional words which will be considered acronyms
func ConfigureAcronym(key, val string) {
uppercaseAcronym[key] = val
uppercaseAcronym.Store(key, val)
}
+9 -2
View File
@@ -35,13 +35,15 @@ func toCamelInitCase(s string, initCase bool) string {
if s == "" {
return s
}
if a, ok := uppercaseAcronym[s]; ok {
s = a
a, hasAcronym := uppercaseAcronym.Load(s)
if hasAcronym {
s = a.(string)
}
n := strings.Builder{}
n.Grow(len(s))
capNext := initCase
prevIsCap := false
for i, v := range []byte(s) {
vIsCap := v >= 'A' && v <= 'Z'
vIsLow := v >= 'a' && v <= 'z'
@@ -55,7 +57,12 @@ func toCamelInitCase(s string, initCase bool) string {
v += 'a'
v -= 'A'
}
} else if prevIsCap && vIsCap && !hasAcronym {
v += 'a'
v -= 'A'
}
prevIsCap = vIsCap
if vIsCap || vIsLow {
n.WriteByte(v)
capNext = false