mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 12:27:49 +00:00
Move _.startCase definition.
This commit is contained in:
@@ -9451,31 +9451,6 @@
|
|||||||
return result + (index ? '-' : '') + word.toLowerCase();
|
return result + (index ? '-' : '') + word.toLowerCase();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts `string` to start case.
|
|
||||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage)
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* @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));
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pads `string` on the left and right sides if it is shorter then the given
|
* Pads `string` on the left and right sides if it is shorter then the given
|
||||||
* padding length. The `chars` string may be truncated if the number of padding
|
* padding length. The `chars` string may be truncated if the number of padding
|
||||||
@@ -9680,6 +9655,31 @@
|
|||||||
return result + (index ? '_' : '') + word.toLowerCase();
|
return result + (index ? '_' : '') + word.toLowerCase();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts `string` to start case.
|
||||||
|
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage)
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* @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));
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `string` starts with the given target string.
|
* Checks if `string` starts with the given target string.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user