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.

14 lines
298 B

'use strict';
function unCamelCase(str) {
return str.replace(/[\w-]+/g, (s) =>
/^[A-Z]?[a-z]*(?:[A-Z][a-z]*)+$/.test(s)
? s
.replace(/[A-Z]/g, (s) => '-' + s.toLowerCase())
.replace(/^(o|ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '-$1')
: s,
);
}
module.exports = unCamelCase;