aboutsummaryrefslogtreecommitdiff
path: root/src/hypixel.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-18 19:52:03 +0000
committermat <github@matdoes.dev>2022-05-18 19:52:03 +0000
commit3fa5d9819476c9da0fc15c6cd90aacf11418b60a (patch)
treec711b531ff8204a204695f03fe0a4aea27a78e12 /src/hypixel.ts
parent11da86901ccfd3d16445f5defe28bb142564fa0a (diff)
downloadskyblock-api-3fa5d9819476c9da0fc15c6cd90aacf11418b60a.tar.gz
skyblock-api-3fa5d9819476c9da0fc15c6cd90aacf11418b60a.tar.bz2
skyblock-api-3fa5d9819476c9da0fc15c6cd90aacf11418b60a.zip
better unknown name auction capitalization
Diffstat (limited to 'src/hypixel.ts')
-rw-r--r--src/hypixel.ts9
1 files changed, 8 insertions, 1 deletions
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
}