You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
412 B

'use strict';
var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
var REVERSE_REGEX = /-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;
module.exports = exports = function kebabCase(str) {
return str.replace(KEBAB_REGEX, function (match) {
return '-' + match.toLowerCase();
});
};
exports.reverse = function (str) {
return str.replace(REVERSE_REGEX, function (match) {
return match.slice(1).toUpperCase();
});
};