Code Node to Replace If-Then Node (or full Javascript inside If-Then node)?

As my workflow’s logic gets more complex, I find that some of my if-then decisions are becoming hard to express in the UI.

For example, I have an OR-linked if-then node that needs a few exceptions. I know I could string yet another if-then onto the canvas, but would rather keep all rules in one node.

Is there another node that has the true/false output paths of if-then, but allows full code?

If not, is there a way to make a code node have true/false outputs?

Please share your workflow

Thank you for the question @hukel. The expressions are JS code themself, so you could convert your conditions to being “true/false” and use more complex expressions. This will not really make the if node easier to follow in my opinion, so you could also prepend a code node before the if node and evaluate the condition there.

For example code node returns true or false:

if (Math.random() > 0.5) return [{json: {result: true}}];

return [{json: {result: false}}];

And the following if node uses it’s output in the expression {{ $json.result }}