feat: add pascalcase function to sprig #430
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
feat: add pascalcase function and change camelcase behaviorDescription
This pull request introduces two changes to the
spriglibrary:1. Added a
pascalcasefunctionA new function,
pascalcase, has been added to thefuncMap. This function converts strings to upper camel case (PascalCase) usingxstrings.ToPascalCase.Example
2. Modified the behavior of
camelcaseThe
camelcasefunction has been updated to explicitly provide lower camel case (lowerCamelCase) behavior usingxstrings.ToCamelCase.Breaking Change
This modification introduces a breaking change, as the previous
camelcasefunction used to convert to upper camel case (PascalCase). However:camelcaseimplies lower camel case.sprig.Rationale
camelcase(lower camel case) andpascalcase(upper camel case), the library becomes easier to understand and use.camelcase, the new behavior makes the function naming consistent with common expectations.Tests Added
pascalcaseand the updatedcamelcasehave been added to ensure expected behavior._)-)Backward Compatibility
camelcasebehavior change: May affect existing users relying on the previous upper camel case functionality.pascalcasefunction: Provides a clear alternative for upper camel case conversion.Example Comparison
Input String | Old camelcase | New camelcase | New pascalcase -- | -- | -- | -- hello_world | HelloWorld | helloWorld | HelloWorld go-programming-lang | GoProgrammingLang | goProgrammingLang | GoProgrammingLangChecklist