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 camelize 10 * @typechecks 11 */ 12 13var _hyphenPattern = /-(.)/g; 14 15/** 16 * Camelcases a hyphenated string, for example: 17 * 18 * > camelize('background-color') 19 * < "backgroundColor" 20 * 21 * @param {string} string 22 * @return {string} 23 */ 24function camelize(string) { 25 return string.replace(_hyphenPattern, function(_, character) { 26 return character.toUpperCase(); 27 }); 28} 29 30module.exports = camelize; 31 32