node-red-contrib-diode 0.2.2

A simple node to isolate the output of a node or function to that further processing cannot affect the original.

npm install 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 http://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.

Node Info

Version: 0.2.2
Updated 1 month, 2 weeks ago
License: MIT

Downloads

14 in the last day
89 in the last week
339 in the last month

Nodes

  • diode

Keywords

  • node-red
  • diode
  • isolate
  • scargill

Maintainers

  • scargill