From 00038f71b1ad599366768a116c4e88cb697c7e26 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 22:40:22 +0000 Subject: [PATCH] Optimize Array Construction in getAllPlayers Replaced manual loop with Array.from(iterator) for better performance and readability. Co-authored-by: PixelMelt <44953835+PixelMelt@users.noreply.github.com> --- src/bot.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/bot.js b/src/bot.js index 4b15a22..6905df0 100644 --- a/src/bot.js +++ b/src/bot.js @@ -540,13 +540,7 @@ class BonkBot { * @returns {Array} Array of player objects */ getAllPlayers() { - const players = []; - - for (const player of this.players.values()) { - players.push(player); - } - - return players; + return Array.from(this.players.values()); }