main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
699 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import capitalize from './capitalize.js';
|
---|
| 2 | import createCompounder from './_createCompounder.js';
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
---|
| 6 | *
|
---|
| 7 | * @static
|
---|
| 8 | * @memberOf _
|
---|
| 9 | * @since 3.0.0
|
---|
| 10 | * @category String
|
---|
| 11 | * @param {string} [string=''] The string to convert.
|
---|
| 12 | * @returns {string} Returns the camel cased string.
|
---|
| 13 | * @example
|
---|
| 14 | *
|
---|
| 15 | * _.camelCase('Foo Bar');
|
---|
| 16 | * // => 'fooBar'
|
---|
| 17 | *
|
---|
| 18 | * _.camelCase('--foo-bar--');
|
---|
| 19 | * // => 'fooBar'
|
---|
| 20 | *
|
---|
| 21 | * _.camelCase('__FOO_BAR__');
|
---|
| 22 | * // => 'fooBar'
|
---|
| 23 | */
|
---|
| 24 | var camelCase = createCompounder(function(result, word, index) {
|
---|
| 25 | word = word.toLowerCase();
|
---|
| 26 | return result + (index ? capitalize(word) : word);
|
---|
| 27 | });
|
---|
| 28 |
|
---|
| 29 | export default camelCase;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.