mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Bump to v3.0.0.
This commit is contained in:
22
string/capitalize.js
Normal file
22
string/capitalize.js
Normal file
@@ -0,0 +1,22 @@
|
||||
define(['../internal/baseToString'], function(baseToString) {
|
||||
|
||||
/**
|
||||
* Capitalizes the first character of `string`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to capitalize.
|
||||
* @returns {string} Returns the capitalized string.
|
||||
* @example
|
||||
*
|
||||
* _.capitalize('fred');
|
||||
* // => 'Fred'
|
||||
*/
|
||||
function capitalize(string) {
|
||||
string = baseToString(string);
|
||||
return string && (string.charAt(0).toUpperCase() + string.slice(1));
|
||||
}
|
||||
|
||||
return capitalize;
|
||||
});
|
||||
Reference in New Issue
Block a user