Browse Source

formatting and whitespace fixes

bug-decimal-undefined
John Robinson 4 years ago
parent
commit
bddd710d74
No known key found for this signature in database
3 changed files with 18 additions and 18 deletions
  1. +3
    -3
      boolean-logic-ultimate/BlinkerUltimate.js
  2. +13
    -13
      boolean-logic-ultimate/FilterUltimate.js
  3. +2
    -2
      boolean-logic-ultimate/InterruptFlowUltimate.js

+ 3
- 3
boolean-logic-ultimate/BlinkerUltimate.js View File

@@ -26,7 +26,7 @@ module.exports = function (RED) {
}
}
if (msg.hasOwnProperty("payload")) {
// 06/11/2019
// 06/11/2019
if (ToBoolean(msg.payload) === true) {
if (node.tBlinker !== null) clearInterval(node.tBlinker);
node.tBlinker = setInterval(handleTimer, node.blinkfrequency); // Start the timer that handles the queue of telegrams
@@ -40,7 +40,7 @@ module.exports = function (RED) {
node.curPayload = false;
}
}
});

node.on('close', function () {
@@ -85,4 +85,4 @@ module.exports = function (RED) {


RED.nodes.registerType("BlinkerUltimate", BlinkerUltimate);
}
}

+ 13
- 13
boolean-logic-ultimate/FilterUltimate.js View File

@@ -10,19 +10,19 @@ module.exports = function(RED) {
if (msg.hasOwnProperty("topic")){
sTopic = (msg.topic === "" ? sTopic : msg.topic);
}
if (typeof msg.payload !== "undefined") {
var bRes = ToBoolean(msg.payload);
if (typeof bRes === "undefined") return;
// 24/01/2020 Clone input message and replace only relevant topics
var msgTrue = RED.util.cloneMessage(msg);
var msgTrue = RED.util.cloneMessage(msg);
msgTrue.topic = sTopic;
msgTrue.payload = true;
var msgFalse = RED.util.cloneMessage(msg);
var msgFalse = RED.util.cloneMessage(msg);
msgFalse.topic = sTopic;
msgFalse.payload = false;
if (bRes === true) {
setNodeStatus({ fill: "green", shape: "dot", text: "(Send) true" });
node.send([msgTrue, null]);
@@ -34,20 +34,20 @@ module.exports = function(RED) {
return;
}
});
function setNodeStatus({fill, shape, text})
{
var dDate = new Date();
node.status({fill: fill,shape: shape,text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")"})
}

function ToBoolean( value ) {
var res = false;
if (typeof value === 'boolean') {
res = value;
}
}
else if( typeof value === 'number' || typeof value === 'string' ) {
// Is it formated as a decimal number?
if( decimal.test( value ) ) {
@@ -58,11 +58,11 @@ module.exports = function(RED) {
res = value.toLowerCase() === "true";
}
}
return res;
};
}
}

RED.nodes.registerType("FilterUltimate",FilterUltimate);
}
}

+ 2
- 2
boolean-logic-ultimate/InterruptFlowUltimate.js View File

@@ -11,7 +11,7 @@ module.exports = function (RED) {
this.on('input', function (msg) {
var sIncomingTopic = "";
if (msg.hasOwnProperty("topic")) {
// 06/11/2019
// 06/11/2019
sIncomingTopic = msg.topic.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, ''); // Cut unwanted Characters
if (sIncomingTopic == node.sTriggerTopic) {
if (msg.hasOwnProperty("play")) {
@@ -73,4 +73,4 @@ module.exports = function (RED) {


RED.nodes.registerType("InterruptFlowUltimate", InterruptFlowUltimate);
}
}

Loading…
Cancel
Save