forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUppercaseFirst.js
More file actions
31 lines (29 loc) · 785 Bytes
/
Copy pathUppercaseFirst.js
File metadata and controls
31 lines (29 loc) · 785 Bytes
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
27
28
29
30
31
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Capitalizes the first letter of a string if there is one.
* @example
* UppercaseFirst('abc');
* // returns 'Abc'
* @example
* UppercaseFirst('the happy family');
* // returns 'The happy family'
* @example
* UppercaseFirst('');
* // returns ''
*
* @function Phaser.Utils.String.UppercaseFirst
* @since 3.0.0
*
* @param {string} str - The string to capitalize.
*
* @return {string} A new string, same as the first, but with the first letter capitalized.
*/
var UppercaseFirst = function (str)
{
return str && str[0].toUpperCase() + str.slice(1);
};
module.exports = UppercaseFirst;