Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
701 bytes
|
Line | |
---|
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 | * @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 | module.exports = camelCase;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.