UNPKG

603 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = capitalize;
7
8// It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
9//
10// A strict capitalization should uppercase the first letter of each word a the sentence.
11// We only handle the first word.
12function capitalize(string) {
13 if (process.env.NODE_ENV !== 'production') {
14 if (typeof string !== 'string') {
15 throw new Error('Material-UI: capitalize(string) expects a string argument.');
16 }
17 }
18
19 return string.charAt(0).toUpperCase() + string.slice(1);
20}
\No newline at end of file