mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v4.7.0.
This commit is contained in:
14
startCase.js
14
startCase.js
@@ -1,26 +1,28 @@
|
||||
define(['./capitalize', './_createCompounder'], function(capitalize, createCompounder) {
|
||||
define(['./_createCompounder', './upperFirst'], function(createCompounder, upperFirst) {
|
||||
|
||||
/**
|
||||
* Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
||||
* Converts `string` to
|
||||
* [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.1.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to convert.
|
||||
* @returns {string} Returns the start cased string.
|
||||
* @example
|
||||
*
|
||||
* _.startCase('--foo-bar');
|
||||
* _.startCase('--foo-bar--');
|
||||
* // => 'Foo Bar'
|
||||
*
|
||||
* _.startCase('fooBar');
|
||||
* // => 'Foo Bar'
|
||||
*
|
||||
* _.startCase('__foo_bar__');
|
||||
* // => 'Foo Bar'
|
||||
* _.startCase('__FOO_BAR__');
|
||||
* // => 'FOO BAR'
|
||||
*/
|
||||
var startCase = createCompounder(function(result, word, index) {
|
||||
return result + (index ? ' ' : '') + capitalize(word);
|
||||
return result + (index ? ' ' : '') + upperFirst(word);
|
||||
});
|
||||
|
||||
return startCase;
|
||||
|
||||
Reference in New Issue
Block a user