A whole bunch of whitespace linting - no functional changes

This commit is contained in:
Dave Conway-Jones
2019-08-11 13:37:15 +01:00
parent 8e2352b08a
commit e20cf97fce
20 changed files with 154 additions and 184 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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"

View File

@@ -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);
}