mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Re-lint a load of nodes
This commit is contained in:
@@ -34,7 +34,8 @@ module.exports = function(RED) {
|
||||
else {
|
||||
if (msg.payload.indexOf(':') > -1) {
|
||||
this.url += 'json={' + msg.payload + '}';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.url += 'csv='+msg.payload;
|
||||
}
|
||||
}
|
||||
@@ -96,7 +97,8 @@ module.exports = function(RED) {
|
||||
if (msg.rc === 200) {
|
||||
try {
|
||||
msg.payload = JSON.parse(msg.payload);
|
||||
} catch(err) {
|
||||
}
|
||||
catch(err) {
|
||||
// Failed to parse, pass it on
|
||||
}
|
||||
node.send(msg);
|
||||
|
@@ -22,7 +22,8 @@ module.exports = function(RED) {
|
||||
this.client = mqlight.createClient(opts, function(err) {
|
||||
if (err) {
|
||||
util.log('[mqlight] ['+id+'] not connected to service '+n.service);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
util.log('[mqlight] ['+id+'] connected to service '+n.service);
|
||||
}
|
||||
});
|
||||
@@ -72,13 +73,15 @@ module.exports = function(RED) {
|
||||
var subscribeCallback = function(err) {
|
||||
if (err) {
|
||||
node.error("Failed to subscribe: " + err);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.log("Subscribed to "+node.topic+(node.share?" ["+node.share+"]":""));
|
||||
}
|
||||
};
|
||||
if (node.share) {
|
||||
recvClient.subscribe(node.topic, node.share, subscribeCallback);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
recvClient.subscribe(node.topic, subscribeCallback);
|
||||
}
|
||||
});
|
||||
@@ -113,7 +116,8 @@ module.exports = function(RED) {
|
||||
if (topic === "") {
|
||||
if (msg.topic) {
|
||||
topic = msg.topic;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.warn("No topic set in MQ Light out node");
|
||||
return;
|
||||
}
|
||||
|
@@ -45,11 +45,13 @@ module.exports = function(RED) {
|
||||
if (!Buffer.isBuffer(payload)) {
|
||||
if (typeof payload === "object") {
|
||||
payload = JSON.stringify(payload);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
payload = payload.toString();
|
||||
}
|
||||
payload += node.addCh;
|
||||
} else if (node.addCh !== "") {
|
||||
}
|
||||
else if (node.addCh !== "") {
|
||||
payload = Buffer.concat([payload,new Buffer(node.addCh)]);
|
||||
}
|
||||
node.port.write(payload,function(err,res) {
|
||||
@@ -66,14 +68,16 @@ module.exports = function(RED) {
|
||||
node.port.on('closed', function() {
|
||||
node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"});
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.error(RED._("serial.errors.missing-conf"));
|
||||
}
|
||||
|
||||
this.on("close", function(done) {
|
||||
if (this.serialConfig) {
|
||||
serialPool.close(this.serialConfig.serialport,done);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
@@ -105,7 +109,8 @@ module.exports = function(RED) {
|
||||
var splitc;
|
||||
if (node.serialConfig.newline.substr(0,2) == "0x") {
|
||||
splitc = new Buffer([parseInt(node.serialConfig.newline)]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
splitc = new Buffer(node.serialConfig.newline.replace("\\n","\n").replace("\\r","\r").replace("\\t","\t").replace("\\e","\e").replace("\\f","\f").replace("\\0","\0")); // jshint ignore:line
|
||||
}
|
||||
|
||||
@@ -169,14 +174,16 @@ module.exports = function(RED) {
|
||||
this.port.on('closed', function() {
|
||||
node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"});
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.error(RED._("serial.errors.missing-conf"));
|
||||
}
|
||||
|
||||
this.on("close", function(done) {
|
||||
if (this.serialConfig) {
|
||||
serialPool.close(this.serialConfig.serialport,done);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
@@ -273,7 +280,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
catch(err) { }
|
||||
delete connections[port];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,8 @@ module.exports = function(RED) {
|
||||
node.session.get(oids.split(","), function(error, varbinds) {
|
||||
if (error) {
|
||||
node.error(error.toString(),msg);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < varbinds.length; i++) {
|
||||
if (snmp.isVarbindError(varbinds[i])) {
|
||||
node.error(snmp.varbindError(varbinds[i]),msg);
|
||||
@@ -62,7 +63,8 @@ module.exports = function(RED) {
|
||||
function responseCb(error, table) {
|
||||
if (error) {
|
||||
console.error(error.toString());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var indexes = [];
|
||||
for (var index in table) {
|
||||
if (table.hasOwnProperty(index)) {
|
||||
|
@@ -41,7 +41,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
};
|
||||
if (this.serverConfig.vhost) {
|
||||
this.stompClientOpts.vhost = this.serverConfig.vhost;
|
||||
this.stompClientOpts.vhost = this.serverConfig.vhost;
|
||||
}
|
||||
|
||||
var node = this;
|
||||
@@ -49,7 +49,7 @@ module.exports = function(RED) {
|
||||
node.client = new StompClient(node.stompClientOpts);
|
||||
|
||||
node.client.on("connect", function() {
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
});
|
||||
|
||||
node.client.on("reconnecting", function() {
|
||||
@@ -110,14 +110,14 @@ module.exports = function(RED) {
|
||||
}
|
||||
};
|
||||
if (this.serverConfig.vhost) {
|
||||
this.stompClientOpts.vhost = this.serverConfig.vhost;
|
||||
this.stompClientOpts.vhost = this.serverConfig.vhost;
|
||||
}
|
||||
|
||||
var node = this;
|
||||
node.client = new StompClient(node.stompClientOpts);
|
||||
|
||||
node.client.on("connect", function() {
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
});
|
||||
|
||||
node.client.on("reconnecting", function() {
|
||||
|
@@ -22,7 +22,8 @@ module.exports = function(RED) {
|
||||
node.log("sent WOL magic packet");
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
}
|
||||
catch(e) {
|
||||
if (RED.settings.verbose) { node.log("WOL: socket error"); }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user