Created
July 28, 2023 11:43
-
-
Save itsmikita/8c1c96cffcfc925514b74c8ca9d8360c to your computer and use it in GitHub Desktop.
Convert CamelCase (or AnyCase) 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
const kebaptize = ( t ) => t.split( "" ).map( ( c, x ) => c === c.toUpperCase() ? `${ x != 0 ? "-" : "" }${ c.toLowerCase() }` : c ).join( "" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment