From ac71a76a2f076fbc244ac3aa2d2a2d54d14a4907 Mon Sep 17 00:00:00 2001 From: Bhargav Date: Fri, 8 Aug 2025 16:19:59 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20fix=20for=20equal=20and=20other=20operat?= =?UTF-8?q?or=20used=20it=20adds=20unwanted=20space.=20(#=E2=80=A6=20(#791?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### **User description** …7639) https://github.com/openobserve/openobserve/issues/7640 ___ ### **PR Type** Other ___ ### **Description** - Remove unnecessary blank lines in addSpacesToOperators - Improve whitespace consistency in while loop - No functional changes made ___

File Walkthrough

Relevant files
Formatting
zincutils.ts
Whitespace cleanup in zincutils.ts                                             

web/src/utils/zincutils.ts
  • Removed extraneous blank lines before and after comment blocks
  • Collapsed spacing within the while loop for readability
  • Preserved existing operator-spacing logic
+0/-7     
___ --- web/src/utils/zincutils.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/web/src/utils/zincutils.ts b/web/src/utils/zincutils.ts index b32999d3a3..3647a33c5e 100644 --- a/web/src/utils/zincutils.ts +++ b/web/src/utils/zincutils.ts @@ -579,19 +579,16 @@ export function addSpacesToOperators(input: string): string { let inSingleQuote = false; let inDoubleQuote = false; let parenDepth = 0; - while (i < input.length) { const char = input[i]; const nextChar = input[i + 1]; const prevChar = i > 0 ? input[i - 1] : ''; - // Track quote states if (char === "'" && !inDoubleQuote) { inSingleQuote = !inSingleQuote; } else if (char === '"' && !inSingleQuote) { inDoubleQuote = !inDoubleQuote; } - // Track parentheses depth (for function calls) if (!inSingleQuote && !inDoubleQuote) { if (char === '(') { @@ -622,7 +619,6 @@ export function addSpacesToOperators(input: string): string { continue; } } - // Handle special case of "! =" (space between ! and =) if (char === '!' && nextChar === ' ' && i + 2 < input.length && input[i + 2] === '=') { // Add space before if needed @@ -637,7 +633,6 @@ export function addSpacesToOperators(input: string): string { i += 3; continue; } - // Handle single-character operators if (char === '=' || char === '>' || char === '<') { // Add space before if needed @@ -653,12 +648,10 @@ export function addSpacesToOperators(input: string): string { continue; } } - // Default: just add the character result += char; i++; } - return result; }