diff options
author | mat <github@matdoes.dev> | 2022-05-17 22:42:18 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-05-17 22:42:18 -0500 |
commit | fbeda39dcffb27ff5aaa0697f2c55d2e1dcc7fd2 (patch) | |
tree | ebd8fe490b88699993bede4082473b9454a523dd /src | |
parent | b5ed021b6ba1dcfaf3162a5e1f686187c209a815 (diff) | |
download | skyblock-api-fbeda39dcffb27ff5aaa0697f2c55d2e1dcc7fd2.tar.gz skyblock-api-fbeda39dcffb27ff5aaa0697f2c55d2e1dcc7fd2.tar.bz2 skyblock-api-fbeda39dcffb27ff5aaa0697f2c55d2e1dcc7fd2.zip |
just make fetchAuctionItemsUncached return an object
Diffstat (limited to 'src')
-rw-r--r-- | src/hypixel.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hypixel.ts b/src/hypixel.ts index 294432d..b579059 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -425,17 +425,17 @@ async function fetchAuctionItemsUncached() { const auctionItemIds = await fetchItemsAuctionsIds() if (!auctionItemIds) return undefined const itemList = await fetchItemList() - const idsToNames: Map<string, string> = new Map() + const idsToNames: Record<string, string> = {} for (const item of itemList.list) // we only return items in auctionItemIds so the response isn't too big, // since usually it would contain stuff that we don't care about like // minions if (auctionItemIds.includes(item.id)) - idsToNames.set(item.id, item.display.name) + idsToNames[item.id] = item.display.name // 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 (!idsToNames.has(item)) - idsToNames.set(item, item.toLowerCase().replace(/^./, item[0].toUpperCase()).replace(/_/g, ' ')) + if (!(item in idsToNames)) + idsToNames[item] = item.toLowerCase().replace(/^./, item[0].toUpperCase()).replace(/_/g, ' ') return idsToNames } |