mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Tidy up jsHint errors in parser nodes
This commit is contained in:
		@@ -16,7 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
module.exports = function(RED) {
 | 
					module.exports = function(RED) {
 | 
				
			||||||
    "use strict";
 | 
					    "use strict";
 | 
				
			||||||
    var notify = require("fs.notify");
 | 
					    var Notify = require("fs.notify");
 | 
				
			||||||
    var fs = require("fs");
 | 
					    var fs = require("fs");
 | 
				
			||||||
    var sep = require("path").sep;
 | 
					    var sep = require("path").sep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -30,7 +30,7 @@ module.exports = function(RED) {
 | 
				
			|||||||
        this.p = (this.files.length == 1) ? this.files[0] : JSON.stringify(this.files);
 | 
					        this.p = (this.files.length == 1) ? this.files[0] : JSON.stringify(this.files);
 | 
				
			||||||
        var node = this;
 | 
					        var node = this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var notifications = new notify(node.files);
 | 
					        var notifications = new Notify(node.files);
 | 
				
			||||||
        notifications.on('change', function (file, event, path) {
 | 
					        notifications.on('change', function (file, event, path) {
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                if (fs.statSync(path).isDirectory()) { path = path + sep + file; }
 | 
					                if (fs.statSync(path).isDirectory()) { path = path + sep + file; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ module.exports = function(RED) {
 | 
				
			|||||||
            if (node.split) {
 | 
					            if (node.split) {
 | 
				
			||||||
                var strings = data.toString().split("\n");
 | 
					                var strings = data.toString().split("\n");
 | 
				
			||||||
                for (var s in strings) {
 | 
					                for (var s in strings) {
 | 
				
			||||||
                    if (strings[s] != "") {
 | 
					                    if (strings[s] !== "") {
 | 
				
			||||||
                        msg.payload = strings[s];
 | 
					                        msg.payload = strings[s];
 | 
				
			||||||
                        node.send(msg);
 | 
					                        node.send(msg);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -50,7 +50,7 @@ module.exports = function(RED) {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.on("close", function() {
 | 
					        this.on("close", function() {
 | 
				
			||||||
            if (tail) tail.kill();
 | 
					            if (tail) { tail.kill(); }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ module.exports = function(RED) {
 | 
				
			|||||||
        this.on("input",function(msg) {
 | 
					        this.on("input",function(msg) {
 | 
				
			||||||
            var filename = msg.filename || this.filename;
 | 
					            var filename = msg.filename || this.filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (filename == "") {
 | 
					            if (filename === "") {
 | 
				
			||||||
                node.warn('No filename specified');
 | 
					                node.warn('No filename specified');
 | 
				
			||||||
            } else if (typeof msg.payload != "undefined") {
 | 
					            } else if (typeof msg.payload != "undefined") {
 | 
				
			||||||
                var data = msg.payload;
 | 
					                var data = msg.payload;
 | 
				
			||||||
@@ -39,20 +39,20 @@ module.exports = function(RED) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                if (msg.hasOwnProperty('delete')) {
 | 
					                if (msg.hasOwnProperty('delete')) {
 | 
				
			||||||
                    fs.unlink(filename, function (err) {
 | 
					                    fs.unlink(filename, function (err) {
 | 
				
			||||||
                        if (err) node.warn('Failed to delete file : '+err);
 | 
					                        if (err) { node.warn('Failed to delete file : '+err); }
 | 
				
			||||||
                        //console.log('Deleted file",filename);
 | 
					                        //console.log('Deleted file",filename);
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
                    if (this.overwriteFile) {
 | 
					                    if (this.overwriteFile) {
 | 
				
			||||||
                        fs.writeFile(filename, data, function (err) {
 | 
					                        fs.writeFile(filename, data, function (err) {
 | 
				
			||||||
                            if (err) node.warn('Failed to write to file : '+err);
 | 
					                            if (err) { node.warn('Failed to write to file : '+err); }
 | 
				
			||||||
                            //console.log('Message written to file',filename);
 | 
					                            //console.log('Message written to file',filename);
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else {
 | 
					                    else {
 | 
				
			||||||
                        fs.appendFile(filename, data, function (err) {
 | 
					                        fs.appendFile(filename, data, function (err) {
 | 
				
			||||||
                            if (err) node.warn('Failed to append to file : '+err);
 | 
					                            if (err) { node.warn('Failed to append to file : '+err); }
 | 
				
			||||||
                            //console.log('Message appended to file',filename);
 | 
					                            //console.log('Message appended to file',filename);
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -75,7 +75,7 @@ module.exports = function(RED) {
 | 
				
			|||||||
        this.on("input",function(msg) {
 | 
					        this.on("input",function(msg) {
 | 
				
			||||||
            var filename = msg.filename || this.filename;
 | 
					            var filename = msg.filename || this.filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (filename == "") {
 | 
					            if (filename === "") {
 | 
				
			||||||
                node.warn('No filename specified');
 | 
					                node.warn('No filename specified');
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                fs.readFile(filename,options,function(err,data) {
 | 
					                fs.readFile(filename,options,function(err,data) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user