mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tidy up jsHint errors in parser nodes
This commit is contained in:
parent
e15de8cf37
commit
790ad8eb68
@ -16,7 +16,7 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var notify = require("fs.notify");
|
||||
var Notify = require("fs.notify");
|
||||
var fs = require("fs");
|
||||
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);
|
||||
var node = this;
|
||||
|
||||
var notifications = new notify(node.files);
|
||||
var notifications = new Notify(node.files);
|
||||
notifications.on('change', function (file, event, path) {
|
||||
try {
|
||||
if (fs.statSync(path).isDirectory()) { path = path + sep + file; }
|
||||
|
@ -33,7 +33,7 @@ module.exports = function(RED) {
|
||||
if (node.split) {
|
||||
var strings = data.toString().split("\n");
|
||||
for (var s in strings) {
|
||||
if (strings[s] != "") {
|
||||
if (strings[s] !== "") {
|
||||
msg.payload = strings[s];
|
||||
node.send(msg);
|
||||
}
|
||||
@ -50,7 +50,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
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) {
|
||||
var filename = msg.filename || this.filename;
|
||||
|
||||
if (filename == "") {
|
||||
if (filename === "") {
|
||||
node.warn('No filename specified');
|
||||
} else if (typeof msg.payload != "undefined") {
|
||||
var data = msg.payload;
|
||||
@ -39,20 +39,20 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (msg.hasOwnProperty('delete')) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (this.overwriteFile) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
else {
|
||||
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);
|
||||
});
|
||||
}
|
||||
@ -75,7 +75,7 @@ module.exports = function(RED) {
|
||||
this.on("input",function(msg) {
|
||||
var filename = msg.filename || this.filename;
|
||||
|
||||
if (filename == "") {
|
||||
if (filename === "") {
|
||||
node.warn('No filename specified');
|
||||
} else {
|
||||
fs.readFile(filename,options,function(err,data) {
|
||||
|
Loading…
Reference in New Issue
Block a user