Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve initialism #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

liyanchang
Copy link
Collaborator

What does this fix or improve?

Here we preserve existing initialisms without them needing to be defined ahead of time.

For instance,

caser := NewCaser(false, nil, nil) // No Go or custom initialisms

// Since we lower case everything, this is `nasa-rocket`
caser.ToCase("NASARocket", LowerCase, '-'))

// If we preserve the initialism, then the result will depend on the input
caser.ToCase("NASARocket", LowerCase|PreserveInitialism, '-')) // NASA-rocket
caser.ToCase("NasaRocket", LowerCase|PreserveInitialism, '-')) // nasa-rocket

This is a possible solution to #8

Is this a breaking change API change or change in behavior?

This will not break or change any existing behavior.*

This does increase the API surface area so I'll let this one sit for a bit before committing to it.

  • The only exception would be if someone specified an int that wasn't a valid WordCase that is now being implemented and that seems both unlikely and previously useless behavior.

Checklist:

  • I have updated the documentation accordingly, if needed.
  • I have added appropriate tests, if needed.

I will likely not merge this for a bit to allow for feedback and also to get more comfortable with the API changes.

@liyanchang liyanchang self-assigned this Jan 14, 2023
@rajatjindal
Copy link

Hi @liyanchang, thank you for your work on this project.

I am trying to use this PR for one of the project that i am working on, and it seems to be working fine as expected. 🎉

one thing that I think might be useful for future is to be able to configure the PreserveInitialism with list of initialism instead of preserving all uppercase letters, but that is not a blocker (atleast for me) at the moment.

do you think we can merge this PR anytime soon?

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants