node-red-contrib-diode
v1.0.2
Published
A simple node to isolate the output of a node or function to that further processing cannot affect the original.
Downloads
59
Maintainers
Readme
node-red-contrib-diode
Purpose
Node-Red-Contrib-Diode is a Node-Red node designed to isolate output from input. That's it, nothing more.
Reason
As messages are normally passed by REFERENCE (as against value). If passing a message from one function to another, there may be times when you want to ensure that any changes you make in the second function are not reflected back into the first - see below for more info. This node will do that for you by making a copy of your message and passing it on.
Of course, passing an object by value uses up slightly more resources than passing by reference so depending on your objects and resources you might not wish to go TOO wild with this?
Oh - and you'd want this for what reason? Should you use node-send to two outputs - and the first one passes onto a node that ALTERS say msg.payload - then your second output could find itself ALTERED! Attaching this node to the first output in these circumstances could prevent such interference.
More information
See https://tech.scargill.net/saturday-node-red-sermon for where this idea came from and why I created it. Many thanks to feedback from blog readers, MrShark for the name and of course Dave CJ of Node-Red fame for the needed function.