iancoleman / strcase

A golang package for converting to snake_case or CamelCase
MIT License
1.01k stars 106 forks source link

adding exceptions #13

Open lrstanley opened 5 years ago

lrstanley commented 5 years ago

Thoughts on adding something similar?:

https://github.com/serenize/snaker/blob/a683aaf2d516deecd70cad0c72e3ca773ecfcef0/snaker.go#L100-L150

This would make it easier to use this for code generation. I.e. something like TEST_HTTP doesn't get converted to TestHttp (which isn't a go standard), rather TestHTTP.

lrstanley commented 5 years ago

I think this would also address issues like https://github.com/iancoleman/strcase/issues/12 (i.e. convert every capital letter after the first into lowercase, unless it matches an exception). This would convert CUSTOMER_ID into CustomerID if done properly.

iancoleman commented 5 years ago

Looks ok.

Only doubt is whether RAM should be on the list for the purpose of this tool.

I'll look into adding this, I think it's a good idea. Thanks for raising the issue.

danielcooperxyz commented 3 years ago

I can't help but think it should be from the lint code file, and would work as a specific GolangCamelCase method.

lrstanley commented 2 years ago

Looks like this was partially added in https://github.com/iancoleman/strcase/commit/10b280f8d209855767061d4b2a3c156dd590a068 quite awhile back, enough for others to be able to specify their own acronyms. Not perfect, but I think it's enough to close this issue.

lrstanley commented 1 year ago

Actually, it looks like that functionality doesn't work as intended. No matter how I try and use ConfigureAcronym.