Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-simple-gate

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-simple-gate - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

54

gate.js

@@ -47,29 +47,33 @@ /**

if (msg.topic !== undefined && msg.topic.toLowerCase() === node.controlTopic) {
switch (msg.payload.toLowerCase()) {
case node.openCmd:
state = 'open';
break;
case node.closeCmd:
state = 'closed';
break;
case node.toggleCmd:
if (state === 'open') {
if (typeof msg.payload != 'string'){
node.error('Command must be a string');
} else {
switch (msg.payload.toLowerCase()) {
case node.openCmd:
state = 'open';
break;
case node.closeCmd:
state = 'closed';
} else {
state = 'open';
}
break;
case node.defaultCmd:
state = node.defaultState;
break;
default:
node.error('Invalid command');
break;
break;
case node.toggleCmd:
if (state === 'open') {
state = 'closed';
} else {
state = 'open';
}
break;
case node.defaultCmd:
state = node.defaultState;
break;
default:
node.error('Invalid command');
break;
}
// Save state
context.set('state',state);
// Show status
status = (state === 'open') ? openStatus:closedStatus;
node.status(status);
node.send(null);
}
// Save state
context.set('state',state);
// Show status
status = (state === 'open') ? openStatus:closedStatus;
node.status(status);
node.send(null);
}

@@ -76,0 +80,0 @@ // Transmit message

{
"name" : "node-red-contrib-simple-gate",
"version" : "0.2.0",
"version" : "0.2.1",
"description" : "A gate node for node-RED",

@@ -5,0 +5,0 @@ "license" : "Apache-2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc