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

20 lines
452 B
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
/* 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)
}
export default hyphenateStyleName