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:
712 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import createCompounder from './_createCompounder.js';
|
---|
| 2 | import upperFirst from './upperFirst.js';
|
---|
| 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 | export default startCase;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.