1 | import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@material-ui/utils";
|
2 | // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
|
3 | //
|
4 | // A strict capitalization should uppercase the first letter of each word a the sentence.
|
5 | // We only handle the first word.
|
6 | export default function capitalize(string) {
|
7 | if (typeof string !== 'string') {
|
8 | throw new Error(process.env.NODE_ENV !== "production" ? `Material-UI: capitalize(string) expects a string argument.` : _formatMuiErrorMessage(7));
|
9 | }
|
10 |
|
11 | return string.charAt(0).toUpperCase() + string.slice(1);
|
12 | } |
\ | No newline at end of file |