Skip to content

Commit

Permalink
chore(private-credential): braces in formatLogicNode
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmoro committed Dec 21, 2024
1 parent c3c8c76 commit b45411d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/features/src/web-connector/utils/render-payload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,31 +142,31 @@ const formatLogicNode = (node: LogicNode, level = 0): string => {
if (!node.inner) {
throw Error("NOT node must have 'inner' node")
}
return `not ${formatLogicNode(node.inner, level)}`
return `not(${formatLogicNode(node.inner, level)})`

case "add":
if (!node.left || !node.right) {
throw Error("ADD node must have both 'left' and 'right' nodes")
}
return `${formatLogicNode(node.left)} + ${formatLogicNode(node.right)}`
return `(${formatLogicNode(node.left)} + ${formatLogicNode(node.right)})`

case "sub":
if (!node.left || !node.right) {
throw Error("SUB node must have both 'left' and 'right' nodes")
}
return `${formatLogicNode(node.left)} - ${formatLogicNode(node.right)}`
return `(${formatLogicNode(node.left)} - ${formatLogicNode(node.right)})`

case "mul":
if (!node.left || !node.right) {
throw Error("MUL node must have both 'left' and 'right' nodes")
}
return `${formatLogicNode(node.left)} x ${formatLogicNode(node.right)}`
return `(${formatLogicNode(node.left)} x ${formatLogicNode(node.right)})`

case "div":
if (!node.left || !node.right) {
throw Error("DIV node must have both 'left' and 'right' nodes")
}
return `${formatLogicNode(node.left)} ÷ ${formatLogicNode(node.right)}`
return `(${formatLogicNode(node.left)} ÷ ${formatLogicNode(node.right)})`

case "record": {
if (!node.data) {
Expand Down

0 comments on commit b45411d

Please sign in to comment.