iancoleman / strcase

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

Camel behaviour change #49

Open DavidS-ovm opened 1 year ago

DavidS-ovm commented 1 year ago

Hi,

this PR is to show the behaviour change of ToCamel/ToLowerCamel as of 0.3.0. The testcase in 262f4c7eed578300626d2acf41c12f45772eb35d passes for 0.2.0 but fails with 0.3.0.

DavidS-ovm commented 1 year ago

I'm not sure which way is "more correct", so I'm just leaving this here for others to find and (for the more knowledgeable of you) to decide.

skunkworker commented 1 year ago

I ran into this issue upgrading from 0.2.0 to 0.3.0 where an already camelized string that had a custom acronym would suddenly become lowercased.

eg:

0.2.0

ToCamel("APIController") -> "APIController"

0.3.0

ToCamel("APIController") -> "ApiController"

wagoodman commented 1 year ago

I ran into the same problem. I can see arguments both ways for correctness. Maybe allow for a separate function for the old behavior or make this configuable?

laknoll commented 11 months ago

I ran into a similar issue. I’d argue that changing behaviour is bad, as it can have quite a few unintended side effects for other packages. How about adding a separate method for the ‘new’ behaviour instead?

jazanne commented 11 months ago

+1 on adding a separate method for the ‘new’ behavior

keaising commented 8 months ago

I ran into a same issue, I think it is a BREAK CHANGE, maybe a new function to implement the new hehavior is better.

alelevinas commented 6 months ago

+1 on this being a BREAKING CHANGE and should be in release notes