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

bug: Kebab case does not handle numbers properly #1338

Closed
MasonVX opened this issue Feb 21, 2024 · 1 comment · Fixed by #1339 · 4 remaining pull requests
Closed

bug: Kebab case does not handle numbers properly #1338

MasonVX opened this issue Feb 21, 2024 · 1 comment · Fixed by #1339 · 4 remaining pull requests
Labels
triage New issues

Comments

@MasonVX
Copy link
Contributor

MasonVX commented Feb 21, 2024

Current Behavior

At the moments icons I add with AddIcons which have numbers included convert those the following way eg.:

"testArrowLeft2" -> "test-arrow-left2"

This is a problem for me when to convert to standalone components in angular. A library uses an icon which has a number at the end and the icon is hardcoded into the library as eg. "test-arrow-left-2".

Expected Behavior

Expected would be "test-arrow-left-2"

Steps to Reproduce

Use an icon with a number at the end.

Code Reproduction URL

No response

Additional Information

The problem seams to be in the used regex:
const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();

possible solution would be:
image

Here not as an image:
/([a-z]|(?=[A-Z]))([A-Z0-9])/g

@MasonVX MasonVX added the triage New issues label Feb 21, 2024
@MasonVX
Copy link
Contributor Author

MasonVX commented Feb 21, 2024

ps. I had time and added a pull request for this issue: #1339

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