lix-website/themes/lix/assets/bootstrap/node_modules/@stylelint/postcss-css-in-js/un-camel-case.js

14 lines
322 B
JavaScript
Raw Normal View History

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