mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 01:45:15 +00:00
20 lines
452 B
JavaScript
20 lines
452 B
JavaScript
/* 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
|