1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

fixed some linting issues

* added some semicolons
* removed double parsing of ```err.stack``` into ```var stack```
This commit is contained in:
t4skforce 2018-07-31 22:54:15 +02:00 committed by GitHub
parent dfa077fd5f
commit d5bdc1600b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,7 @@ module.exports = function(RED) {
if (type === 'object') { if (type === 'object') {
type = Buffer.isBuffer(msg)?'Buffer':(util.isArray(msg)?'Array':'Date'); type = Buffer.isBuffer(msg)?'Buffer':(util.isArray(msg)?'Array':'Date');
} }
node.error(RED._("function.error.non-message-returned",{ type: type })) node.error(RED._("function.error.non-message-returned",{ type: type }));
} }
} }
} }
@ -203,9 +203,9 @@ module.exports = function(RED) {
if (util.hasOwnProperty('promisify')) { if (util.hasOwnProperty('promisify')) {
sandbox.setTimeout[util.promisify.custom] = function(after, value) { sandbox.setTimeout[util.promisify.custom] = function(after, value) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
sandbox.setTimeout(function(){ resolve(value) }, after); sandbox.setTimeout(function(){ resolve(value); }, after);
}); });
} };
} }
var context = vm.createContext(sandbox); var context = vm.createContext(sandbox);
try { try {
@ -241,7 +241,6 @@ module.exports = function(RED) {
var line = 0; var line = 0;
var errorMessage; var errorMessage;
var stack = err.stack.split(/\r?\n/);
if (stack.length > 0) { if (stack.length > 0) {
while (line < stack.length && stack[line].indexOf("ReferenceError") !== 0) { while (line < stack.length && stack[line].indexOf("ReferenceError") !== 0) {
line++; line++;
@ -265,13 +264,13 @@ module.exports = function(RED) {
}); });
this.on("close", function() { this.on("close", function() {
while (node.outstandingTimers.length > 0) { while (node.outstandingTimers.length > 0) {
clearTimeout(node.outstandingTimers.pop()) clearTimeout(node.outstandingTimers.pop());
} }
while (node.outstandingIntervals.length > 0) { while (node.outstandingIntervals.length > 0) {
clearInterval(node.outstandingIntervals.pop()) clearInterval(node.outstandingIntervals.pop());
} }
this.status({}); this.status({});
}) });
} catch(err) { } catch(err) {
// eg SyntaxError - which v8 doesn't include line number information // eg SyntaxError - which v8 doesn't include line number information
// so we can't do better than this // so we can't do better than this
@ -280,4 +279,4 @@ module.exports = function(RED) {
} }
RED.nodes.registerType("function",FunctionNode); RED.nodes.registerType("function",FunctionNode);
RED.library.register("functions"); RED.library.register("functions");
} };