@pkmn/sim 0.5.23 → 0.5.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/data/tags.ts CHANGED
@@ -200,7 +200,7 @@ export const Tags: {[id: string]: TagData} = {
200
200
  'Aerodactyl-Mega', 'Alakazam', 'Blacephalon', 'Blaziken', 'Diancie-Mega', 'Gallade-Mega', 'Gardevoir-Mega', 'Gengar', 'Gyarados',
201
201
  'Gyarados-Mega', 'Hawlucha', 'Heracross-Mega', 'Hoopa-Unbound', 'Hydreigon', 'Jirachi', 'Latias', 'Latias-Mega', 'Latios',
202
202
  'Latios-Mega', 'Manaphy', 'Medicham-Mega', 'Melmetal', 'Mew', 'Moltres-Galar', 'Pinsir-Mega', 'Sableye-Mega', 'Slowbro-Mega',
203
- 'Slowking-Galar', 'Thundurus', 'Venusaur-Mega', 'Xurkitree', 'Zapdos-Galar',
203
+ 'Slowking-Galar', 'Thundurus', 'Thundurus-Therian', 'Venusaur-Mega', 'Xurkitree', 'Zapdos-Galar',
204
204
  ].includes(species.name),
205
205
  },
206
206
 
package/lib/utils.ts CHANGED
@@ -63,6 +63,22 @@ export function stripHTML(htmlContent: string) {
63
63
  return htmlContent.replace(/<[^>]*>/g, '');
64
64
  }
65
65
 
66
+ /**
67
+ * Maps numbers to their ordinal string.
68
+ */
69
+ export function formatOrder(place: number) {
70
+ // anything between 10 and 20 should always end with -th
71
+ let remainder = place % 100;
72
+ if (remainder >= 10 && remainder <= 20) return place + 'th';
73
+
74
+ // follow standard rules with -st, -nd, -rd, and -th
75
+ remainder = place % 10;
76
+ if (remainder === 1) return place + 'st';
77
+ if (remainder === 2) return place + 'nd';
78
+ if (remainder === 3) return place + 'rd';
79
+ return place + 'th';
80
+ }
81
+
66
82
  /**
67
83
  * Visualizes eval output in a slightly more readable form
68
84
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/sim",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "description": "An automatically generated extraction of just the simulator portion of Pokémon Showdown",
5
5
  "homepage": "https://psim.us",
6
6
  "main": "build/sim/index.js",