From c9319daea87b3bdb22840576577693cee29b98c7 Mon Sep 17 00:00:00 2001 From: Bart Veneman <1536852+bartveneman@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:02:40 +0200 Subject: [PATCH] avoid calling `String.repeat()` unnecessarily in minify mode --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 63282dc..5efda0e 100644 --- a/index.js +++ b/index.js @@ -45,7 +45,6 @@ export function format(css, { minify = false } = {}) { parseValue: true, }) - const TAB = minify ? EMPTY_STRING : '\t' const NEWLINE = minify ? EMPTY_STRING : '\n' const OPTIONAL_SPACE = minify ? EMPTY_STRING : SPACE const LAST_SEMICOLON = minify ? EMPTY_STRING : SEMICOLON @@ -58,7 +57,7 @@ export function format(css, { minify = false } = {}) { * @returns A string with {size} tabs */ function indent(size) { - return TAB.repeat(size) + return minify ? EMPTY_STRING : '\t'.repeat(size) } /**