Created
November 2, 2019 16:41
-
-
Save avilde/d62d0419f8b9e23446b01cba622e518e to your computer and use it in GitHub Desktop.
Convert text from camel to kebab case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const camelToKebabCase = (text: string) => { | |
return text.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment