main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
452 bytes
|
Line | |
---|
1 | /* eslint-disable no-var, prefer-template */
|
---|
2 | var uppercasePattern = /[A-Z]/g
|
---|
3 | var msPattern = /^ms-/
|
---|
4 | var cache = {}
|
---|
5 |
|
---|
6 | function toHyphenLower(match) {
|
---|
7 | return '-' + match.toLowerCase()
|
---|
8 | }
|
---|
9 |
|
---|
10 | function hyphenateStyleName(name) {
|
---|
11 | if (cache.hasOwnProperty(name)) {
|
---|
12 | return cache[name]
|
---|
13 | }
|
---|
14 |
|
---|
15 | var hName = name.replace(uppercasePattern, toHyphenLower)
|
---|
16 | return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
|
---|
17 | }
|
---|
18 |
|
---|
19 | export default hyphenateStyleName
|
---|
Note:
See
TracBrowser
for help on using the repository browser.