Skip to content

Commit

Permalink
Add mapping for specific item names to URL format
Browse files Browse the repository at this point in the history
Introduced a lookup object in the formatItemNameToURL function to convert specific item names directly to their corresponding URL strings. This adjustment ensures that certain items are formatted accurately, preventing potential errors in URL generation for these cases.
  • Loading branch information
MateusZ36 committed Dec 9, 2024
1 parent 8056d1e commit bf798da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ function getGEPrice(itemName: string): number {
}

function formatItemNameToURL(itemName: string): string {
let itemsList = {
"Rune arrowheads": "Rune_arrowheads_5",
"Magic seed": "Magic_seed_5",
"Onyx bolt tips": "Onyx_bolt_tips_5",
"Ciku seed": "Ciku_seed_5",
"Golden dragonfruit seed": "Golden_dragonfruit_seed_5",
}

let name = itemsList[itemName]
if (name) {
return name;
}
return itemName.replace(/ /g, "_");
}

Expand Down

0 comments on commit bf798da

Please sign in to comment.