Skip to content

Commit 1f14697

Browse files
authored
Lowercase SCREAMING_SNAKE_CASE handled properly for key names (#89)
1 parent 21f5ce0 commit 1f14697

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

json-to-go.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ function jsonToGo(json, typename, flatten = true)
320320
// Proper cases a string according to Go conventions
321321
function toProperCase(str)
322322
{
323+
// ensure that the SCREAMING_SNAKE_CASE is converted to snake_case
324+
str=str.toLowerCase();
325+
323326
// https://github.com/golang/lint/blob/5614ed5bae6fb75893070bdc0996a68765fdd275/lint.go#L771-L810
324327
const commonInitialisms = [
325328
"ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP",

0 commit comments

Comments
 (0)