Skip to content

Commit 3c55595

Browse files
kkkiioZiheng Xie
andauthored
Better handling of SCREAMING_SNAKE_CASE field names (#83)
Co-authored-by: Ziheng Xie <[email protected]>
1 parent 39f55ce commit 3c55595

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

json-to-go.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ function jsonToGo(json, typename, flatten = true)
328328
"URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS"
329329
];
330330

331-
return str.replace(/(^|[^a-zA-Z])([a-z]+)/g, function(unused, sep, frag)
331+
return str.replace(/(^|[^a-zA-Z])((?:[a-z]|[A-Z])+)/g, function(unused, sep, frag)
332332
{
333333
if (commonInitialisms.indexOf(frag.toUpperCase()) >= 0)
334334
return sep + frag.toUpperCase();

0 commit comments

Comments
 (0)