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