GT2/Ejectable/node_modules/hyphenate-style-name/index.cjs.js

22 lines
474 B
JavaScript

'use strict';
/* eslint-disable no-var, prefer-template */
var uppercasePattern = /[A-Z]/g;
var msPattern = /^ms-/;
var cache = {};
function toHyphenLower(match) {
return '-' + match.toLowerCase()
}
function hyphenateStyleName(name) {
if (cache.hasOwnProperty(name)) {
return cache[name]
}
var hName = name.replace(uppercasePattern, toHyphenLower);
return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
}
module.exports = hyphenateStyleName;