9 lines
216 B
JavaScript
9 lines
216 B
JavaScript
var camel2hyphen = function (str) {
|
|
return str
|
|
.replace(/[A-Z]/g, function (match) {
|
|
return '-' + match.toLowerCase();
|
|
})
|
|
.toLowerCase();
|
|
};
|
|
|
|
module.exports = camel2hyphen; |