mirror of
https://github.com/ncarlier/webhookd.git
synced 2024-09-20 08:55:28 +00:00
parent
d233cdc776
commit
3021c19551
|
@ -20,8 +20,8 @@ func ToSnakeCase(in string) string {
|
|||
}
|
||||
out = append(out, unicode.ToLower(runes[i]))
|
||||
}
|
||||
|
||||
return strings.Replace(string(out), "-", "", -1)
|
||||
result := strings.Replace(string(out), "/", "_", -1)
|
||||
return strings.Replace(result, "-", "", -1)
|
||||
}
|
||||
|
||||
// QueryParamsToShellVars convert URL query parameters to shell vars.
|
||||
|
|
|
@ -17,6 +17,8 @@ func TestToSnakeCase(t *testing.T) {
|
|||
{"hello-world", "helloworld"},
|
||||
{"helloWorld", "hello_world"},
|
||||
{"HelloWorld", "hello_world"},
|
||||
{"Hello/World", "hello__world"},
|
||||
{"Hello/world", "hello_world"},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
value := tools.ToSnakeCase(tc.value)
|
||||
|
|
Loading…
Reference in New Issue
Block a user