From 3f87af0428dc0bc309e7904aa311958b1d1820f5 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Wed, 28 Aug 2024 20:57:24 +0200 Subject: [PATCH] =?UTF-8?q?guh=C2=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/interaction/slash/utils/weather.js | 20 ++++++-------------- commands/message/utils/weather.js | 20 ++++++-------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/commands/interaction/slash/utils/weather.js b/commands/interaction/slash/utils/weather.js index 5e318d8..3d9d3b3 100644 --- a/commands/interaction/slash/utils/weather.js +++ b/commands/interaction/slash/utils/weather.js @@ -24,20 +24,12 @@ function temperature(value, units){ } function getUvIndex(i){ - switch(i){ - case i <= 2: - return "uv_index_0" - case i <= 5: - return "uv_index_1" - case i <= 7: - return "uv_index_2" - case i <= 10: - return "uv_index_3" - case i <= 11: - return "uv_index_4" - default: - return "question" - } + if(i <= 2) return "uv_index_0" + else if(i <= 5) return "uv_index_1" + else if(i <= 7) return "uv_index_2" + else if(i <= 10) return "uv_index_3" + else if(i <= 11) return "uv_index_4" + else return "question" } function renderWeatherCard(context, data, units){ diff --git a/commands/message/utils/weather.js b/commands/message/utils/weather.js index 65480aa..11d0190 100644 --- a/commands/message/utils/weather.js +++ b/commands/message/utils/weather.js @@ -24,20 +24,12 @@ function temperature(value, units){ } function getUvIndex(i){ - switch(i){ - case i <= 2: - return "uv_index_0" - case i <= 5: - return "uv_index_1" - case i <= 7: - return "uv_index_2" - case i <= 10: - return "uv_index_3" - case i <= 11: - return "uv_index_4" - default: - return "question" - } + if(i <= 2) return "uv_index_0" + else if(i <= 5) return "uv_index_1" + else if(i <= 7) return "uv_index_2" + else if(i <= 10) return "uv_index_3" + else if(i <= 11) return "uv_index_4" + else return "question" } function renderWeatherCard(context, data, units){