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

Apply casing to chars except the ones after a number (issue #77) #109

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

Conversation

leomav
Copy link

@leomav leomav commented Jun 22, 2023

In this PR

Based on this issue #77
If understood correctly, what's needed is for strings' characters to change to lower case or upper case only if they are not after a number. For example:

camelCase('Textures_3d') // -> textures3d
camelCase('Textures_3D') // -> textures3D
camelCase('textures_3d', {pascalCase: true}) // -> Textures3d
camelCase('textures_3D, {pascalCase: true}') // -> Textures3D

Chars after numbers do not change

index.js

Created a helper function called applyCasingExceptAfterNumber, which is responsible to apply case functions to all chars except the ones after a number. It takes as parameters the string, and the case function.

test.js

Updated 6 tests in order for the new desired effect to be the correct one

package.json

Update the xo dependency version in order for tests to run due to a bug presented in previous xojs/xo versions

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

Successfully merging this pull request may close these issues.

1 participant