1/** 2 * Copyright 2013-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 hyphenateStyleName 10 * @typechecks 11 */ 12 13"use strict"; 14 15var hyphenate = require('hyphenate'); 16 17var msPattern = /^ms-/; 18 19/** 20 * Hyphenates a camelcased CSS property name, for example: 21 * 22 * > hyphenateStyleName('backgroundColor') 23 * < "background-color" 24 * > hyphenateStyleName('MozTransition') 25 * < "-moz-transition" 26 * > hyphenateStyleName('msTransition') 27 * < "-ms-transition" 28 * 29 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix 30 * is converted to `-ms-`. 31 * 32 * @param {string} string 33 * @return {string} 34 */ 35function hyphenateStyleName(string) { 36 return hyphenate(string).replace(msPattern, '-ms-'); 37} 38 39module.exports = hyphenateStyleName; 40 41