mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
A whole bunch of whitespace linting - no functional changes
This commit is contained in:
parent
8e2352b08a
commit
e20cf97fce
@ -21,7 +21,7 @@ module.exports = function(RED) {
|
||||
this.on("input",function(msg) {
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
if (msg.hasOwnProperty("topic") && (typeof msg.topic === "string") && (msg.topic !== "")) {
|
||||
delete node.previous[msg.topic];
|
||||
delete node.previous[msg.topic];
|
||||
}
|
||||
else { node.previous = {}; }
|
||||
}
|
||||
|
@ -179,8 +179,8 @@ module.exports = function(RED) {
|
||||
node.board.sysexCommand(msg.payload);
|
||||
}
|
||||
if (node.state === "STRING") {
|
||||
node.board.sendString(msg.payload.toString());
|
||||
}
|
||||
node.board.sendString(msg.payload.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
node.board.once('disconnect', function() {
|
||||
|
@ -92,7 +92,7 @@ module.exports = function(RED) {
|
||||
var val;
|
||||
if (node.intype == "up") { val = 1; }
|
||||
if (node.intype == "down") { val = 0; }
|
||||
setTimeout(function(){
|
||||
setTimeout(function() {
|
||||
node.send({ topic:"pi/"+node.pin, payload:val });
|
||||
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:val})});
|
||||
},250);
|
||||
@ -194,7 +194,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||
node.on("input", function(msg){
|
||||
node.on("input", function(msg) {
|
||||
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:msg.payload.toString()})});
|
||||
});
|
||||
}
|
||||
@ -303,14 +303,14 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
node.on("close", function(done) {
|
||||
node.status({});
|
||||
if (node.child != null) {
|
||||
node.finished = done;
|
||||
node.child.kill('SIGINT');
|
||||
node.child = null;
|
||||
}
|
||||
else { done(); }
|
||||
});
|
||||
node.status({});
|
||||
if (node.child != null) {
|
||||
node.finished = done;
|
||||
node.child.kill('SIGINT');
|
||||
node.child = null;
|
||||
}
|
||||
else { done(); }
|
||||
});
|
||||
}
|
||||
else {
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||
|
@ -90,7 +90,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||
node.on("input", function(msg){
|
||||
node.on("input", function(msg) {
|
||||
node.status({fill:"grey",shape:"dot",text:RED._("node-red:rpi-gpio.status.na",{value:msg.payload.toString()})});
|
||||
});
|
||||
}
|
||||
|
@ -145,43 +145,6 @@ module.exports = function(RED) {
|
||||
break;
|
||||
}
|
||||
|
||||
//case "holiday" : {
|
||||
//if (DEBUG) {
|
||||
//hminnode.log("Hit the holiday case");
|
||||
//}
|
||||
//if (!('enabled' in message.payload[key]) && !('time' in message.payload[key])) {
|
||||
//hminnode.log("Warning: Unsupported 'holiday' value passed!");
|
||||
//eturn;
|
||||
//}
|
||||
//var time = message.payload[key].time;
|
||||
//// Ensure hminnode time is a date
|
||||
//if (typeof(time) == "string") {
|
||||
//hminnode.log("Typeof time was " +typeof(message.payload[key].time));
|
||||
//// message.payload[key].time = new Date(message.payload[key].time);
|
||||
//message.payload[key].time = new Date(2014, 02, 15, 12, 0, 0);
|
||||
//hminnode.log("Typeof time is now " +typeof(message.payload[key].time));
|
||||
//}
|
||||
//// Also add in away mode (for hot water) if we're on hols
|
||||
//if (message.payload[key].time) {
|
||||
//message.payload.away_mode = 1;
|
||||
//}
|
||||
//else {
|
||||
//message.payload.away_mode = 0;
|
||||
//}
|
||||
//break;
|
||||
// }
|
||||
|
||||
//case "hotwater" : {
|
||||
//if (DEBUG) {
|
||||
//hminnode.log("Hit the hotwater case");
|
||||
//}
|
||||
//if (message.payload[key] !== "on" && message.payload[key] !== "boost" && message.payload[key] !== "off") {
|
||||
//hminnode.log("Warning: Unsupported 'hotwater' value passed!");
|
||||
//return;
|
||||
//}
|
||||
//break;
|
||||
// }
|
||||
|
||||
case "heating" : {
|
||||
// Ensure heating stays last! It's got a multi write scenario
|
||||
if (DEBUG) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
|
||||
//import noble
|
||||
|
@ -44,10 +44,13 @@ module.exports = function(RED) {
|
||||
sensorTag.enableIrTemperature(function() {});
|
||||
sensorTag.on('irTemperatureChange',
|
||||
function(objectTemperature, ambientTemperature) {
|
||||
var msg = {'topic': node.topic + '/temperature'};
|
||||
msg.payload = {'object': +objectTemperature.toFixed(1),
|
||||
'ambient': +ambientTemperature.toFixed(1)
|
||||
};
|
||||
var msg = {
|
||||
'topic': node.topic + '/temperature',
|
||||
'payload': {
|
||||
'object': +objectTemperature.toFixed(1),
|
||||
'ambient': +ambientTemperature.toFixed(1)
|
||||
}
|
||||
}
|
||||
node.send(msg);
|
||||
});
|
||||
sensorTag.enableBarometricPressure(function() {});
|
||||
@ -59,8 +62,9 @@ module.exports = function(RED) {
|
||||
sensorTag.enableHumidity(function() {});
|
||||
sensorTag.on('humidityChange', function(temp, humidity) {
|
||||
var msg = {'topic': node.topic + '/humidity'};
|
||||
msg.payload = {'temperature': +temp.toFixed(1),
|
||||
'humidity': +humidity.toFixed(1)
|
||||
msg.payload = {
|
||||
'temperature': +temp.toFixed(1),
|
||||
'humidity': +humidity.toFixed(1)
|
||||
};
|
||||
if ((temp !== -40) || (humidity !== 100)) {
|
||||
node.send(msg);
|
||||
|
@ -30,7 +30,7 @@ module.exports = function(RED) {
|
||||
this.on("input", function(msg) {
|
||||
|
||||
// setup the data for the URI
|
||||
if (this.datatype == "legacy"){
|
||||
if (this.datatype == "legacy") {
|
||||
this.url = this.baseurl + '/input/post.json?';
|
||||
if (typeof(msg.payload) !== "string") {
|
||||
this.url += 'json=' + JSON.stringify(msg.payload);
|
||||
@ -44,15 +44,15 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.datatype == "fulljson"){
|
||||
else if (this.datatype == "fulljson") {
|
||||
this.url = this.baseurl + '/input/post?';
|
||||
this.url += 'fulljson=' + encodeURIComponent(JSON.stringify(msg.payload));
|
||||
}
|
||||
else if (this.datatype == "json"){
|
||||
else if (this.datatype == "json") {
|
||||
this.url = this.baseurl + '/input/post?';
|
||||
this.url += 'json={' + encodeURIComponent(msg.payload) + '}';
|
||||
}
|
||||
else if (this.datatype == "CSV"){
|
||||
else if (this.datatype == "CSV") {
|
||||
this.url = this.baseurl + '/input/post?';
|
||||
this.url += 'csv=' + msg.payload;
|
||||
}
|
||||
@ -80,7 +80,7 @@ module.exports = function(RED) {
|
||||
// node.warn("WARN: Time object undefined, no time set");
|
||||
}
|
||||
else {
|
||||
if (!isNaN(msg.time)) {
|
||||
if (!isNaN(msg.time)) {
|
||||
this.url += '&time=' + msg.time;
|
||||
}
|
||||
else {
|
||||
@ -113,7 +113,7 @@ module.exports = function(RED) {
|
||||
try {
|
||||
msg.payload = JSON.parse(body);
|
||||
}
|
||||
catch (e) {
|
||||
catch (e) {
|
||||
msg.payload = body;
|
||||
}
|
||||
|
||||
|
@ -174,16 +174,16 @@ module.exports = function(RED) {
|
||||
return {
|
||||
get:function(serialConfig) {
|
||||
// make local copy of configuration -- perhaps not needed?
|
||||
var port = serialConfig.serialport,
|
||||
baud = serialConfig.serialbaud,
|
||||
databits = serialConfig.databits,
|
||||
parity = serialConfig.parity,
|
||||
stopbits = serialConfig.stopbits,
|
||||
newline = serialConfig.newline,
|
||||
spliton = serialConfig.out,
|
||||
waitfor = serialConfig.waitfor,
|
||||
var port = serialConfig.serialport,
|
||||
baud = serialConfig.serialbaud,
|
||||
databits = serialConfig.databits,
|
||||
parity = serialConfig.parity,
|
||||
stopbits = serialConfig.stopbits,
|
||||
newline = serialConfig.newline,
|
||||
spliton = serialConfig.out,
|
||||
waitfor = serialConfig.waitfor,
|
||||
binoutput = serialConfig.bin,
|
||||
addchar = serialConfig.addchar,
|
||||
addchar = serialConfig.addchar,
|
||||
responsetimeout = serialConfig.responsetimeout;
|
||||
var id = port;
|
||||
// just return the connection object if already have one
|
||||
@ -320,6 +320,7 @@ module.exports = function(RED) {
|
||||
obj.serial.on('error', function(err) {
|
||||
RED.log.error(RED._("serial.errors.error",{port:port,error:err.toString()}));
|
||||
obj._emitter.emit('closed');
|
||||
if (obj.tout) { clearTimeout(obj.tout); }
|
||||
obj.tout = setTimeout(function() {
|
||||
setupSerial();
|
||||
}, settings.serialReconnectTime);
|
||||
@ -328,6 +329,7 @@ module.exports = function(RED) {
|
||||
if (!obj._closing) {
|
||||
RED.log.error(RED._("serial.errors.unexpected-close",{port:port}));
|
||||
obj._emitter.emit('closed');
|
||||
if (obj.tout) { clearTimeout(obj.tout); }
|
||||
obj.tout = setTimeout(function() {
|
||||
setupSerial();
|
||||
}, settings.serialReconnectTime);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-serialport",
|
||||
"version" : "0.8.3",
|
||||
"version" : "0.8.4",
|
||||
"description" : "Node-RED nodes to talk to serial ports",
|
||||
"dependencies" : {
|
||||
"serialport" : "^7.1.5"
|
||||
|
@ -67,7 +67,6 @@ module.exports = function(RED) {
|
||||
node.log('subscribing to: '+node.topic);
|
||||
node.client.subscribe(node.topic, function(body, headers) {
|
||||
var newmsg={"headers":headers,"topic":node.topic}
|
||||
|
||||
try {
|
||||
newmsg.payload = JSON.parse(body);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ module.exports = function(RED) {
|
||||
var value = RED.util.getMessageProperty(msg,node.property);
|
||||
if (value !== undefined) {
|
||||
if (typeof value === "string") {
|
||||
// try to decode it...
|
||||
// try to decode it...
|
||||
var regexp = new RegExp('^[a-z0-9]{1,9}$'); // can only contain a-z or 0-9 and length 1-9
|
||||
if (regexp.test(value)) {
|
||||
var po = geohash.decode(value);
|
||||
|
@ -4,14 +4,19 @@
|
||||
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of Smaz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
// Neither the name of Smaz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Our compression codebook
|
||||
var rc = [
|
||||
var rc = [
|
||||
" ", "the", "e", "t", "a", "of", "o", "and", "i", "n", "s", "e ", "r", " th", " t", "in", "he", "th", "h", "he ", "to", "\r\n", "l", "s ", "d", " a", "an","er", "c", " o", "d ", "on", " of", "re", "of ", "t ", ", ", "is", "u", "at", " ", "n ", "or", "which", "f", "m", "as", "it", "that", "\n", "was", "en", " ", " w", "es", " an", " i", "\r", "f ", "g", "p", "nd", " s", "nd ", "ed ", "w", "ed", "http://", "for", "te", "ing", "y ", "The", " c", "ti", "r ", "his", "st", " in", "ar", "nt", ",", " to", "y", "ng", " h", "with", "le", "al", "to ", "b", "ou", "be", "were", " b", "se", "o ", "ent", "ha", "ng ", "their", "\"", "hi", "from", " f", "in ", "de", "ion", "me", "v", ".", "ve", "all", "re ", "ri", "ro", "is ", "co", "f t", "are", "ea", ". ", "her", " m", "er ", " p", "es ", "by", "they", "di", "ra", "ic", "not", "s, ", "d t", "at ", "ce", "la", "h ", "ne", "as ", "tio", "on ", "n t", "io", "we", " a ", "om", ", a", "s o", "ur", "li", "ll", "ch", "had", "this", "e t", "g ", "e\r\n", " wh", "ere", " co", "e o", "a ", "us", " d", "ss", "\n\r\n", "\r\n\r", "=\"", " be", " e", "s a", "ma", "one", "t t", "or ", "but", "el", "so", "l ", "e s", "s,", "no", "ter", " wa", "iv", "ho", "e a", " r", "hat", "s t", "ns", "ch ", "wh", "tr", "ut", "/", "have", "ly ", "ta", " ha", " on", "tha", "-", " l", "ati", "en ", "pe", " re", "there", "ass", "si", " fo", "wa", "ec", "our", "who", "its", "z", "fo", "rs", ">", "ot", "un", "<", "im", "th ", "nc", "ate", "><", "ver", "ad", " we", "ly", "ee", " n", "id", " cl", "ac", "il", "</", "rt", " wi", "div", "e, ", " it", "whi", " ma", "ge", "x", "�", "\'>", "=\'"];
|
||||
|
||||
var cb = rc.reduce(function(result, item, index, array) {
|
||||
@ -20,103 +25,100 @@ var cb = rc.reduce(function(result, item, index, array) {
|
||||
}, {})
|
||||
|
||||
var smaz = module.exports = {
|
||||
codebook: cb,
|
||||
reverse_codebook: rc,
|
||||
flush_verbatim: function(verbatim) {
|
||||
var output = [];
|
||||
if (verbatim.length > 1) {
|
||||
output.push(255);
|
||||
output.push(verbatim.length-1);
|
||||
} else {
|
||||
output.push(254);
|
||||
}
|
||||
var k = 0;
|
||||
for (; k < verbatim.length; k++) {
|
||||
output.push(verbatim.charCodeAt(k));
|
||||
}
|
||||
return output;
|
||||
},
|
||||
codebook: cb,
|
||||
reverse_codebook: rc,
|
||||
flush_verbatim: function(verbatim) {
|
||||
var output = [];
|
||||
if (verbatim.length > 1) {
|
||||
output.push(255);
|
||||
output.push(verbatim.length-1);
|
||||
} else {
|
||||
output.push(254);
|
||||
}
|
||||
var k = 0;
|
||||
for (; k < verbatim.length; k++) {
|
||||
output.push(verbatim.charCodeAt(k));
|
||||
}
|
||||
return output;
|
||||
},
|
||||
|
||||
compress: function(input) {
|
||||
var verbatim = "";
|
||||
var output = [];
|
||||
var input_index = 0;
|
||||
compress: function(input) {
|
||||
var verbatim = "";
|
||||
var output = [];
|
||||
var input_index = 0;
|
||||
|
||||
while (input_index < input.length) {
|
||||
// Try to lookup substrings into the hash table, starting from the
|
||||
// longer to the shorter substrings
|
||||
var encoded = false;
|
||||
var j = 7;
|
||||
while (input_index < input.length) {
|
||||
// Try to lookup substrings into the hash table, starting from the
|
||||
// longer to the shorter substrings
|
||||
var encoded = false;
|
||||
var j = 7;
|
||||
|
||||
if (input.length-input_index < 7) {
|
||||
j = input.length-input_index;
|
||||
}
|
||||
if (input.length-input_index < 7) {
|
||||
j = input.length-input_index;
|
||||
}
|
||||
|
||||
for (; j > 0; j--) {
|
||||
var code = smaz.codebook[input.substr(input_index,j)];
|
||||
if (code != undefined) {
|
||||
// Match found in the hash table,
|
||||
// Flush verbatim bytes if needed
|
||||
if (verbatim) {
|
||||
for (; j > 0; j--) {
|
||||
var code = smaz.codebook[input.substr(input_index,j)];
|
||||
if (code != undefined) {
|
||||
// Match found in the hash table,
|
||||
// Flush verbatim bytes if needed
|
||||
if (verbatim) {
|
||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||
verbatim = "";
|
||||
}
|
||||
// Emit the byte
|
||||
output.push(code);
|
||||
input_index += j;
|
||||
encoded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!encoded) {
|
||||
// Match not found - add the byte to the verbatim buffer
|
||||
verbatim += input[input_index];
|
||||
input_index++;
|
||||
// Flush if we reached the verbatim bytes length limit
|
||||
if (verbatim.length == 256) {
|
||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||
verbatim = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Flush verbatim bytes if needed
|
||||
if (verbatim) {
|
||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||
verbatim = "";
|
||||
}
|
||||
// Emit the byte
|
||||
output.push(code);
|
||||
|
||||
input_index += j;
|
||||
|
||||
encoded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!encoded) {
|
||||
// Match not found - add the byte to the verbatim buffer
|
||||
verbatim += input[input_index];
|
||||
input_index++;
|
||||
return new Uint8Array(output);
|
||||
},
|
||||
|
||||
// Flush if we reached the verbatim bytes length limit
|
||||
if (verbatim.length == 256) {
|
||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||
verbatim = "";
|
||||
decompress: function(input) {
|
||||
var output = "";
|
||||
var i = 0;
|
||||
while (i < input.length) {
|
||||
if (input[i] === 254) {
|
||||
// Verbatim byte
|
||||
if (i+1 >= input.length) {
|
||||
throw "Malformed smaz.";
|
||||
}
|
||||
output += String.fromCharCode(input[i+1]);
|
||||
i += 2;
|
||||
} else if (input[i] === 255) {
|
||||
// Verbatim string
|
||||
var j;
|
||||
if (i+input[i+1]+2 >= input.length) {
|
||||
throw "Malformed smaz.";
|
||||
}
|
||||
for (j = 0; j < input[i+1]+1; j++) {
|
||||
output += String.fromCharCode(input[i+2+j]);
|
||||
}
|
||||
i += 3+input[i+1];
|
||||
} else {
|
||||
// Codebook entry
|
||||
output += smaz.reverse_codebook[input[i]];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
// Flush verbatim bytes if needed
|
||||
if (verbatim) {
|
||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||
verbatim = "";
|
||||
}
|
||||
return new Uint8Array(output);
|
||||
},
|
||||
|
||||
decompress: function(input) {
|
||||
var output = "";
|
||||
var i = 0;
|
||||
while (i < input.length) {
|
||||
if (input[i] === 254) {
|
||||
// Verbatim byte
|
||||
if (i+1 >= input.length) {
|
||||
throw "Malformed smaz.";
|
||||
}
|
||||
output += String.fromCharCode(input[i+1]);
|
||||
i += 2;
|
||||
} else if(input[i] === 255) {
|
||||
// Verbatim string
|
||||
var j;
|
||||
if (i+input[i+1]+2 >= input.length) {
|
||||
throw "Malformed smaz.";
|
||||
}
|
||||
for (j = 0; j < input[i+1]+1; j++) {
|
||||
output += String.fromCharCode(input[i+2+j]);
|
||||
}
|
||||
i += 3+input[i+1];
|
||||
} else {
|
||||
// Codebook entry
|
||||
output += smaz.reverse_codebook[input[i]];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ module.exports = function(RED) {
|
||||
if (flag) {
|
||||
RED.nodes.addCredentials(n.id,{userid:this.userid, password:this.password, global:true});
|
||||
}
|
||||
if (n.tls === false){
|
||||
if (n.tls === false) {
|
||||
this.tls = false;
|
||||
}
|
||||
var node = this;
|
||||
@ -289,7 +289,7 @@ module.exports = function(RED) {
|
||||
// and pass in the email message. The parser will signal when it has parsed the message.
|
||||
SimpleParser(data, {}, function(err, parsed) {
|
||||
//node.log(util.format("SimpleParser: on(end): %j", mailObject));
|
||||
if (err){
|
||||
if (err) {
|
||||
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
||||
node.error(RED._("email.errors.parsefail", {folder:node.box}), err);
|
||||
}
|
||||
@ -391,7 +391,7 @@ module.exports = function(RED) {
|
||||
imapMessage.on('body', function(stream, info) {
|
||||
//console.log("> message - body - stream=?, info=%j", info);
|
||||
SimpleParser(stream, {}, function(err, parsed) {
|
||||
if (err){
|
||||
if (err) {
|
||||
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
||||
node.error(RED._("email.errors.parsefail", {folder:node.box}),err);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ module.exports = function(RED) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.title = n.title;
|
||||
var node = this;
|
||||
|
||||
|
||||
node.on("input",function(msg) {
|
||||
var title = node.title || msg.topic;
|
||||
if (typeof msg.payload === 'object') {
|
||||
|
@ -519,10 +519,10 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
|
||||
function filterdActiveDevices(devices){
|
||||
function filterdActiveDevices(devices) {
|
||||
var activeDevices = [];
|
||||
for(var i=0;i<devices.length;i++){
|
||||
if(devices[i].active){
|
||||
for (var i=0; i<devices.length; i++) {
|
||||
if (devices[i].active) {
|
||||
activeDevices.push(devices[i]);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ module.exports = function(RED) {
|
||||
// Is it base64 encoded or binary?
|
||||
var attachmentString = attachment.toString();
|
||||
var attachmentBuffer = Buffer.from(attachmentString,'base64');
|
||||
if(attachmentString === attachmentBuffer.toString('base64')) {
|
||||
if (attachmentString === attachmentBuffer.toString('base64')) {
|
||||
// If converts back to same, then it was base64 so set to binary
|
||||
// https://stackoverflow.com/a/48770228
|
||||
attachment = attachmentBuffer;
|
||||
|
@ -505,7 +505,7 @@ module.exports = function(RED) {
|
||||
var missingUsernames = Object.keys(missingUsers).join(",");
|
||||
return node.twitterConfig.getUsers(missingUsernames).then(function() {
|
||||
var len = tweets.length;
|
||||
for (var i = 0;i < len; i++) {
|
||||
for (var i = 0; i < len; i++) {
|
||||
var tweet = messages[i];
|
||||
var output = tweets[i];
|
||||
output.sender = userObjectCache[tweet.message_create.sender_id];
|
||||
|
@ -49,7 +49,7 @@ module.exports = function(RED) {
|
||||
var bind = [];
|
||||
|
||||
var doQuery = function(msg) {
|
||||
if (node.sqlquery == "msg.topic"){
|
||||
if (node.sqlquery == "msg.topic") {
|
||||
if (typeof msg.topic === 'string') {
|
||||
if (msg.topic.length > 0) {
|
||||
bind = Array.isArray(msg.payload) ? msg.payload : [];
|
||||
@ -84,7 +84,7 @@ module.exports = function(RED) {
|
||||
node.status({fill:"red", shape:"dot",text:"msg.topic error"});
|
||||
}
|
||||
}
|
||||
if (node.sqlquery == "fixed"){
|
||||
if (node.sqlquery == "fixed") {
|
||||
if (typeof node.sql === 'string') {
|
||||
if (node.sql.length > 0) {
|
||||
node.mydbConfig.db.all(node.sql, bind, function(err, row) {
|
||||
@ -96,14 +96,14 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
if (node.sql === null || node.sql == "") {
|
||||
node.error("SQL statement config not set up",msg);
|
||||
node.status({fill:"red",shape:"dot",text:"SQL config not set up"});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.sqlquery == "prepared"){
|
||||
if (node.sqlquery == "prepared") {
|
||||
if (typeof node.sql === 'string' && typeof msg.params !== "undefined" && typeof msg.params === "object") {
|
||||
if (node.sql.length > 0) {
|
||||
node.mydbConfig.db.all(node.sql, msg.params, function(err, row) {
|
||||
|
@ -75,7 +75,7 @@ module.exports = function(RED) {
|
||||
else {
|
||||
if (exifData) {
|
||||
msg.exif = exifData;
|
||||
if((exifData.hasOwnProperty("gps")) && (Object.keys(exifData.gps).length !== 0)) {
|
||||
if ((exifData.hasOwnProperty("gps")) && (Object.keys(exifData.gps).length !== 0)) {
|
||||
addMsgLocationDataFromExifGPSData(msg);
|
||||
}
|
||||
//else { node.log("The incoming image did not contain Exif GPS data."); }
|
||||
|
Loading…
Reference in New Issue
Block a user