summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/startCase.js
blob: 740d48a513c4fd5bfca1c565af8bdc500ba25155 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var createCompounder = require('../internal/createCompounder');

/**
 * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
 *
 * @static
 * @memberOf _
 * @category String
 * @param {string} [string=''] The string to convert.
 * @returns {string} Returns the start cased string.
 * @example
 *
 * _.startCase('--foo-bar');
 * // => 'Foo Bar'
 *
 * _.startCase('fooBar');
 * // => 'Foo Bar'
 *
 * _.startCase('__foo_bar__');
 * // => 'Foo Bar'
 */
var startCase = createCompounder(function(result, word, index) {
  return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
});

module.exports = startCase;