Skip to content

Instantly share code, notes, and snippets.

@rayfranco
Last active February 11, 2018 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rayfranco/abbe6b9dcf66282aa5bc71fbd7b105c8 to your computer and use it in GitHub Desktop.
Save rayfranco/abbe6b9dcf66282aa5bc71fbd7b105c8 to your computer and use it in GitHub Desktop.
module.exports = (string) => {
return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
}
module.exports = (string) => {
return string.replace(/-([a-z])/g, (a, b) => b.toUpperCase())
}
module.exports = (string) => {
return string.replace(/(?:^|-)([a-z])/g, (a, b) => b.toUpperCase())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment