UNPKG

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