Skip to content

Instantly share code, notes, and snippets.

@gugadev
Forked from nblackburn/camelToKebab.js
Created September 8, 2019 01:36
Show Gist options
  • Save gugadev/3c690da15d6e99b8452293e02aa360d4 to your computer and use it in GitHub Desktop.
Save gugadev/3c690da15d6e99b8452293e02aa360d4 to your computer and use it in GitHub Desktop.
Convert a string from camel case to kebab case.
module.exports = (string) => {
return string.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