Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
714 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var createCompounder = require('./_createCompounder'),
|
---|
| 2 | upperFirst = require('./upperFirst');
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * Converts `string` to
|
---|
| 6 | * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
---|
| 7 | *
|
---|
| 8 | * @static
|
---|
| 9 | * @memberOf _
|
---|
| 10 | * @since 3.1.0
|
---|
| 11 | * @category String
|
---|
| 12 | * @param {string} [string=''] The string to convert.
|
---|
| 13 | * @returns {string} Returns the start cased string.
|
---|
| 14 | * @example
|
---|
| 15 | *
|
---|
| 16 | * _.startCase('--foo-bar--');
|
---|
| 17 | * // => 'Foo Bar'
|
---|
| 18 | *
|
---|
| 19 | * _.startCase('fooBar');
|
---|
| 20 | * // => 'Foo Bar'
|
---|
| 21 | *
|
---|
| 22 | * _.startCase('__FOO_BAR__');
|
---|
| 23 | * // => 'FOO BAR'
|
---|
| 24 | */
|
---|
| 25 | var startCase = createCompounder(function(result, word, index) {
|
---|
| 26 | return result + (index ? ' ' : '') + upperFirst(word);
|
---|
| 27 | });
|
---|
| 28 |
|
---|
| 29 | module.exports = startCase;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.