Skip to content

bug: Kebab case does not handle numbers properly #1338

Closed
@MasonVX

Description

@MasonVX

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions