Whether I use one approach or the other depends on the complexity of the input vs the complexity of the output. It really doesn’t matter except that it is often easier to read a single function node that several complex change nodes as an example.
So my general rules of thumb for whether to replace a collection of nodes with a function node are:
- How difficult would this be to do in a pure flow? If it is just a couple of nodes, that’s fine, if it is 10 nodes then probably not fine.
- If I am using JSONata, how long is it taking me to puzzle over the JSONata code? If it is a few minutes then fine, otherwise use a function node!