From 4c3bc2d80f98d84ddbd8306c826286f42f627e0a Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Tue, 26 Nov 2024 10:14:21 -0800 Subject: [PATCH] fix best-version determination for versions >9 --- lib/mystery-box.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mystery-box.js b/lib/mystery-box.js index c7ddf18..080bc17 100644 --- a/lib/mystery-box.js +++ b/lib/mystery-box.js @@ -98,7 +98,7 @@ class MysteryBox extends EventEmitter { }, {}); // Default to highest - this.bestVersion = Number(Object.keys(this.versionParameters).sort().pop()); + this.bestVersion = Number(Object.keys(this.versionParameters).sort((a, b) => a - b).pop()); if (Number.isNaN(this.bestVersion)) { throw new MysteryBoxError('no supported versions available'); } -- 2.49.0