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
|
// add underscore if next letter case type is changed
|
||||||
if (vIsCap && nextIsLow) || (vIsLow && nextIsCap) {
|
if (vIsCap && nextIsLow) || (vIsLow && nextIsCap) {
|
||||||
if prevIgnore := ignore > 0 && i > 0 && s[i-1] == ignore; !prevIgnore {
|
if prevIgnore := ignore > 0 && i > 0 && s[i-1] == ignore; !prevIgnore {
|
||||||
if i > 0 && vIsCap && nextIsLow {
|
if vIsCap && nextIsLow {
|
||||||
if prevDelim := len(n) > 0 && n[len(n)-1] == delimiter; !prevDelim {
|
if prevIsCap := i > 0 && s[i-1] >= 'A' && s[i-1] <= 'Z'; prevIsCap {
|
||||||
n += string(delimiter)
|
n += string(delimiter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func toSnakeWithIgnore(tb testing.TB) {
|
|||||||
{"JSONData", "json_data"},
|
{"JSONData", "json_data"},
|
||||||
{"AwesomeActivity.UserID", "awesome_activity.user_id", "."},
|
{"AwesomeActivity.UserID", "awesome_activity.user_id", "."},
|
||||||
{"AwesomeActivity.User.Id", "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 {
|
for _, i := range cases {
|
||||||
in := i[0]
|
in := i[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user