Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81158 views
1
/**
2
* Copyright 2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule camelizeStyleName
10
* @typechecks
11
*/
12
13
"use strict";
14
15
var camelize = require('camelize');
16
17
var msPattern = /^-ms-/;
18
19
/**
20
* Camelcases a hyphenated CSS property name, for example:
21
*
22
* > camelizeStyleName('background-color')
23
* < "backgroundColor"
24
* > camelizeStyleName('-moz-transition')
25
* < "MozTransition"
26
* > camelizeStyleName('-ms-transition')
27
* < "msTransition"
28
*
29
* As Andi Smith suggests
30
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
31
* is converted to lowercase `ms`.
32
*
33
* @param {string} string
34
* @return {string}
35
*/
36
function camelizeStyleName(string) {
37
return camelize(string.replace(msPattern, 'ms-'));
38
}
39
40
module.exports = camelizeStyleName;
41
42