From a2c5b8156f7b5db195fad9e1722baed618fd1f17 Mon Sep 17 00:00:00 2001 From: 1ilit Date: Wed, 24 Apr 2024 18:28:28 +0300 Subject: [PATCH] Remove nested parentheses for checks --- src/utils/astToDiagram.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/astToDiagram.js b/src/utils/astToDiagram.js index eb20da1..92991ad 100644 --- a/src/utils/astToDiagram.js +++ b/src/utils/astToDiagram.js @@ -9,7 +9,7 @@ function buildSQLFromAST(ast) { if (ast.type === "binary_expr") { const leftSQL = buildSQLFromAST(ast.left); const rightSQL = buildSQLFromAST(ast.right); - return `(${leftSQL}) ${ast.operator} (${rightSQL})`; + return `${leftSQL} ${ast.operator} ${rightSQL}`; } if (ast.type === "function") { @@ -37,7 +37,7 @@ function buildSQLFromAST(ast) { } else if (ast.type === "expr_list") { return ast.value.map((v) => v.value).join(" AND "); } else { - return ast.value; + return typeof ast.value === "string" ? "'" + ast.value + "'" : ast.value; } }