Skip to content

Instantly share code, notes, and snippets.

@c01nd01r
Created October 21, 2017 13:49
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 c01nd01r/729a293df2a84fc6920fa0e395769938 to your computer and use it in GitHub Desktop.
Save c01nd01r/729a293df2a84fc6920fa0e395769938 to your computer and use it in GitHub Desktop.
Hyphenate a camelCase string. (Vue.js)
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = function(str) {
return str.replace(hyphenateRE, '-$1').toLowerCase()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment