1var createCompounder = require('../internal/createCompounder'); 2 3/** 4 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 5 * 6 * @static 7 * @memberOf _ 8 * @category String 9 * @param {string} [string=''] The string to convert. 10 * @returns {string} Returns the camel cased string. 11 * @example 12 * 13 * _.camelCase('Foo Bar'); 14 * // => 'fooBar' 15 * 16 * _.camelCase('--foo-bar'); 17 * // => 'fooBar' 18 * 19 * _.camelCase('__foo_bar__'); 20 * // => 'fooBar' 21 */ 22var camelCase = createCompounder(function(result, word, index) { 23 word = word.toLowerCase(); 24 return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word); 25}); 26 27module.exports = camelCase; 28 29