GoScrobble/web/node_modules/hyphenate-style-name/index.cjs.js

22 lines
474 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
'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;