1
0
Fork 0
Stonks_mau/spa/src/PrettifyStatisticName.js

17 lines
394 B
JavaScript
Raw Normal View History

2021-07-09 05:01:42 +00:00
const prettifyStatisticName = (type, name) => {
return toTitleCase(
`${type.replace("custom", "")} ${name}`
.replaceAll("minecraft:", "")
.replaceAll("_", " ")
.trim()
);
};
function toTitleCase(str) {
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
export default prettifyStatisticName;