Closed bminer closed 7 months ago
This was working in v4 when using the camelCaseTransformMerge
function.
changeCase.camelCase(str, {
transform: changeCase.camelCaseTransformMerge,
})
Have you tried disabling the separateNumbers
option? I think that should do what you’re asking for, you just have to be aware that it’s not reversible (same as v4 though).
Edit: Sorry, was on mobile/vacation, I see you tried it. I’ll have to look when I’m back at my computer.
I have published a new release with a mergeAmbiguousCharacters
option for camelCase
and pascalCase
.
For the sake of this issue, I do want to clarify that this isn't a bug but expected behavior (without the option enabled). It works the same way in v4.
The behavior wasn't related to separateNumbers
(which splits V1
into V_1
), but instead the standard formatting of these two methods that prefixes an _
before numbers which can be unclear. Using your example, it's impossible to reverse email_1_address
if it turns into Email1Address
because it may be intentional to do email1
vs email_1
.
Anyway, hopefully mergeAmbiguousCharacters
supports your use-case in v5.2.
Looks great! Thanks, Blake!
Here's a new bug in v5.
Whenever a number is prefixed by a
_
in snake case, change-case does not properly convert to the appropriate case.Example:
Output:
'Email_1Address'
in both cases Expected:Email1Address
, I think in both casesThis even breaks when converting cases back and forth:
Output:
'email_1Address'
Expected:email1Address