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