@material-ui/core
Version:
React components that implement Google's Material Design.
20 lines (17 loc) • 603 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = capitalize;
// 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 a the sentence.
// We only handle the first word.
function capitalize(string) {
if (process.env.NODE_ENV !== 'production') {
if (typeof string !== 'string') {
throw new Error('Material-UI: capitalize(string) expects a string argument.');
}
}
return string.charAt(0).toUpperCase() + string.slice(1);
}
;