ionicons icon indicating copy to clipboard operation
ionicons copied to clipboard

bug: Kebab case does not handle numbers properly

Open MasonVX opened this issue 1 year ago • 1 comments

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 avatar Feb 21 '24 14:02 MasonVX

ps. I had time and added a pull request for this issue: https://github.com/ionic-team/ionicons/pull/1339

MasonVX avatar Feb 21 '24 15:02 MasonVX