Skip to content

Instantly share code, notes, and snippets.

@pastukh-dm
pastukh-dm / pascalToKebab.js
Created August 27, 2019 14:31 — forked from nblackburn/camelToKebab.js
Convert a string from camel case to kebab case.
module.exports = (string) => {
return string
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
.replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2')
.toLowerCase();
};