1
0
Fork 0
react-playground/node_modules/@mui/utils/esm/capitalize/capitalize.js

11 lines
No EOL
577 B
JavaScript

import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
// It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
//
// A strict capitalization should uppercase the first letter of each word in the sentence.
// We only handle the first word.
export default function capitalize(string) {
if (typeof string !== 'string') {
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `capitalize(string)` expects a string argument.' : _formatErrorMessage(7));
}
return string.charAt(0).toUpperCase() + string.slice(1);
}