Skip to content

Commit

Permalink
Merge branch 'master' into feature/achronyms-underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni committed Nov 4, 2018
2 parents bd71682 + 1f6e977 commit d036eae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ident.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ func toParts(s string) []string {
prev = c
continue
}
if unicode.IsUpper(c) && baseAcronyms[strings.ToUpper(x)] {
parts = xappend(parts, x)
x = cs
prev = c
continue
}
if unicode.IsLetter(c) || unicode.IsDigit(c) || unicode.IsPunct(c) || c == '`' {
prev = c
x += cs
Expand Down
3 changes: 3 additions & 0 deletions ident_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func Test_New(t *testing.T) {
{"widget/ID", []string{"widget", "ID"}},
{"widgetID", []string{"widget", "ID"}},
{"widgetName", []string{"widget", "Name"}},
{"JWTName", []string{"JWT", "Name"}},
{"JWTname", []string{"JWTname"}},
{"jwtname", []string{"jwtname"}},
{"sql", []string{"SQL"}},
{"sQl", []string{"SQL"}},
{"id", []string{"ID"}},
Expand Down

0 comments on commit d036eae

Please sign in to comment.