]>
Commit | Line | Data |
---|---|---|
5422a9cc TL |
1 | /** |
2 | * @fileoverview Utilities to operate on strings. | |
3 | * @author Stephen Wade | |
4 | */ | |
5 | ||
6 | "use strict"; | |
7 | ||
8 | /** | |
9 | * Converts the first letter of a string to uppercase. | |
10 | * @param {string} string The string to operate on | |
11 | * @returns {string} The converted string | |
12 | */ | |
13 | function upperCaseFirst(string) { | |
14 | if (string.length <= 1) { | |
15 | return string.toUpperCase(); | |
16 | } | |
17 | return string[0].toUpperCase() + string.slice(1); | |
18 | } | |
19 | ||
20 | module.exports = { | |
21 | upperCaseFirst | |
22 | }; |