Created
December 8, 2018 19:25
-
-
Save Piterden/5a5f9af63f8af7567a7da5318e282251 to your computer and use it in GitHub Desktop.
[JS] Camel to dash transform and opposite
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
| 'dash-cased-string'.split('-').map((part, idx) => idx ? part.charAt(0).toUpperCase() + part.slice(1) : part).join('') | |
| 'camelCasedString'.replace(/([A-Z])/g, '-$1').toLowerCase() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment