From 3fa5d9819476c9da0fc15c6cd90aacf11418b60a Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 18 May 2022 19:52:03 +0000 Subject: better unknown name auction capitalization --- src/hypixel.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/hypixel.ts') diff --git a/src/hypixel.ts b/src/hypixel.ts index ebe2eea..e0575dd 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -469,7 +469,14 @@ async function fetchAuctionItemsUncached() { // if the item in the database isn't in the items api, just set the name to the id for (const item of auctionItemIds) if (!(item in idsToData)) - idsToData[item] = { display: { name: item.toLowerCase().replace(/^./, item[0].toUpperCase()).replace(/_/g, ' ') } } + idsToData[item] = { + display: { + name: (item.toLowerCase().replace(/^./, item[0].toUpperCase()).replace(/_/g, ' ')).replace( + /\w\S*/g, + w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase() + ) + } + } return idsToData } -- cgit