Skip to content

Commit

Permalink
Remove special case for ID to fix ID by itself
Browse files Browse the repository at this point in the history
  • Loading branch information
duckbrain authored and sio4 committed Mar 12, 2022
1 parent e28b95b commit ba81877
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions camelize.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func (i Ident) Camelize() Ident {
for i, part := range i.Parts {
var x string
var capped bool
if strings.ToLower(part) == "id" {
out = append(out, "ID")
continue
}
for _, c := range part {
if unicode.IsLetter(c) || unicode.IsDigit(c) {
if i == 0 {
Expand Down
2 changes: 2 additions & 0 deletions camelize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ func Test_Camelize(t *testing.T) {
table := []tt{
{"", ""},
{"bob dylan", "bobDylan"},
{"id", "id"},
{"ID", "id"},
{"widgetID", "widgetID"},
{"widget_ID", "widgetID"},
{"Widget_ID", "widgetID"},
Expand Down
2 changes: 2 additions & 0 deletions pascalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ func Test_Pascalize(t *testing.T) {
table := []tt{
{"", ""},
{"bob dylan", "BobDylan"},
{"ID", "ID"},
{"id", "ID"},
{"widgetID", "WidgetID"},
{"widget_ID", "WidgetID"},
{"Widget_ID", "WidgetID"},
Expand Down

0 comments on commit ba81877

Please sign in to comment.