Socket
Book a DemoInstallSign in
Socket

node-red-contrib-diode

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-diode

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

npmnpm
Version
0.2.1
Version published
Weekly downloads
30
328.57%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

node-red

FAQs

Package last updated on 01 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts