forked from Minecraft/Stonks
17 lines
394 B
JavaScript
17 lines
394 B
JavaScript
|
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;
|