From 7cbafe8839e16109ba647a1ad6deefe71c82a96d Mon Sep 17 00:00:00 2001 From: acalcutt Date: Sun, 29 Dec 2024 03:19:21 -0500 Subject: [PATCH] Update serve_style.js Co-Authored-By: Andrew Calcutt --- src/serve_style.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serve_style.js b/src/serve_style.js index ec8a0b4..d0c2e3b 100644 --- a/src/serve_style.js +++ b/src/serve_style.js @@ -18,9 +18,9 @@ const allowedSpriteFormats = allowedOptions(['png', 'json']); * @returns {string} formated string for the scale or empty string if scale is invalid */ function allowedSpriteScales(scale) { - if (!scale) return ''; // Default to 1 if no scale provided - const match = scale.match(/(\d+)x/); // Match one or more digits before 'x' - const parsedScale = match ? parseInt(match[1], 10) : 1; // Parse the number, or default to 1 if no match + if (!scale) return ''; + const match = scale.match(/(\d+)x/); + const parsedScale = match ? parseInt(match[1], 10) : 1; return '@' + Math.min(parsedScale, 3) + 'x'; }