Remove nested parentheses for checks
This commit is contained in:
parent
a88bc9799f
commit
a2c5b8156f
@ -9,7 +9,7 @@ function buildSQLFromAST(ast) {
|
|||||||
if (ast.type === "binary_expr") {
|
if (ast.type === "binary_expr") {
|
||||||
const leftSQL = buildSQLFromAST(ast.left);
|
const leftSQL = buildSQLFromAST(ast.left);
|
||||||
const rightSQL = buildSQLFromAST(ast.right);
|
const rightSQL = buildSQLFromAST(ast.right);
|
||||||
return `(${leftSQL}) ${ast.operator} (${rightSQL})`;
|
return `${leftSQL} ${ast.operator} ${rightSQL}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast.type === "function") {
|
if (ast.type === "function") {
|
||||||
@ -37,7 +37,7 @@ function buildSQLFromAST(ast) {
|
|||||||
} else if (ast.type === "expr_list") {
|
} else if (ast.type === "expr_list") {
|
||||||
return ast.value.map((v) => v.value).join(" AND ");
|
return ast.value.map((v) => v.value).join(" AND ");
|
||||||
} else {
|
} else {
|
||||||
return ast.value;
|
return typeof ast.value === "string" ? "'" + ast.value + "'" : ast.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user