Fix incorrect delimiter between dot and cap
This commit is contained in:
parent
486369db5a
commit
a6b8dcde35
4
snake.go
4
snake.go
@ -78,8 +78,8 @@ func ToScreamingDelimited(s string, delimiter uint8, ignore uint8, screaming boo
|
||||
// add underscore if next letter case type is changed
|
||||
if (vIsCap && nextIsLow) || (vIsLow && nextIsCap) {
|
||||
if prevIgnore := ignore > 0 && i > 0 && s[i-1] == ignore; !prevIgnore {
|
||||
if i > 0 && vIsCap && nextIsLow {
|
||||
if prevDelim := len(n) > 0 && n[len(n)-1] == delimiter; !prevDelim {
|
||||
if vIsCap && nextIsLow {
|
||||
if prevIsCap := i > 0 && s[i-1] >= 'A' && s[i-1] <= 'Z'; prevIsCap {
|
||||
n += string(delimiter)
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func toSnakeWithIgnore(tb testing.TB) {
|
||||
{"JSONData", "json_data"},
|
||||
{"AwesomeActivity.UserID", "awesome_activity.user_id", "."},
|
||||
{"AwesomeActivity.User.Id", "awesome_activity.user.id", "."},
|
||||
{"AwesomeUsername@Awesome.Com", "awesome_username@awesome._com", "@"},
|
||||
{"AwesomeUsername@Awesome.Com", "awesome_username@awesome.com", "@"},
|
||||
}
|
||||
for _, i := range cases {
|
||||
in := i[0]
|
||||
|
Loading…
Reference in New Issue
Block a user