diff --git a/Gruntfile.js b/Gruntfile.js index 8165d8b37..3c22f67c4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -44,11 +44,31 @@ module.exports = function(grunt) { }, all: [ 'Gruntfile.js', - 'public/red/**/*.js', 'red.js', 'red/**/*.js', 'nodes/**/*.js', + 'public/red/**/*.js' ], + + core: { + files: { + src: [ + 'Gruntfile.js', + 'red.js', + 'red/**/*.js' + ] + } + }, + nodes: { + files: { + src: [ 'nodes/**/*.js' ] + } + }, + editor: { + files: { + src: [ 'public/red/**/*.js' ] + } + }, tests: { files: { src: ['test/*.js'] @@ -65,6 +85,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask('default', ['jshint:tests','simplemocha']); - grunt.registerTask('all', ['jshint:all','default']); + grunt.registerTask('all', ['jshint:core','jshint:nodes','jshint:editor','default']); }; diff --git a/red/library.js b/red/library.js index 0310ffc88..92f79302f 100644 --- a/red/library.js +++ b/red/library.js @@ -90,7 +90,7 @@ function createLibrary(type) { }).otherwise(function(err) { util.log("[red] Error saving library entry '"+path+"' : "+err); res.send(500); - });; + }); }); }); } diff --git a/red/log.js b/red/log.js index 147ba92f9..2df1e57cb 100644 --- a/red/log.js +++ b/red/log.js @@ -30,9 +30,9 @@ var log = module.exports = { }, log: function(msg) { - for (var i in logHandlers) { + logHandlers.each(function() { logHandlers[i].emit("log",msg); - } + }); } } diff --git a/red/nodes/Node.js b/red/nodes/Node.js index 99d6df579..86f2b006d 100644 --- a/red/nodes/Node.js +++ b/red/nodes/Node.js @@ -66,7 +66,7 @@ Node.prototype.send = function(msg) { } else if (!util.isArray(msg)) { msg = [msg]; } - for (var i in this.wires) { + for (var i=0;i 0) { util.log("[red] Waiting for missing types to be registered:"); - for (var i in missingTypes) { + for (i=0;i"; if (el.attribs) { - for (var i in el.attribs) { - openTag += " "+i+'="'+el.attribs[i]+'"'; + for (var j in el.attribs) { + if (el.attribs.hasOwnProperty(j)) { + openTag += " "+i+'="'+el.attribs[j]+'"'; + } } } openTag += ">"; @@ -288,8 +292,8 @@ var typeRegistry = module.exports = { result += node_configs[i]; } result += ''; return result; diff --git a/red/storage/localfilesystem.js b/red/storage/localfilesystem.js index c8cabb569..dedaac55c 100644 --- a/red/storage/localfilesystem.js +++ b/red/storage/localfilesystem.js @@ -127,7 +127,9 @@ function writeFile(root,path,meta,body,res) { var fn = fspath.join(root,path); var headers = ""; for (var i in meta) { - headers += "// "+i+": "+meta[i]+"\n"; + if (meta.hasOwnProperty(i)) { + headers += "// "+i+": "+meta[i]+"\n"; + } } mkdirp(fspath.dirname(fn), function (err) { fs.writeFile(fn,headers+body,function(err) { @@ -255,7 +257,9 @@ var localfilesystem = { var rootPath = fspath.join(libDir,type,path); return promiseDir(root).then(function () { return nodeFn.call(fs.lstat, rootPath).then(function(stats) { - if (stats.isFile()) return getFileBody(root,path); + if (stats.isFile()) { + return getFileBody(root,path); + } if (path.substr(-1) == '/') { path = path.substr(0,path.length-1); } @@ -286,7 +290,9 @@ var localfilesystem = { var fn = fspath.join(libDir, type, path); var headers = ""; for (var i in meta) { - headers += "// "+i+": "+meta[i]+"\n"; + if (meta.hasOwnProperty(i)) { + headers += "// "+i+": "+meta[i]+"\n"; + } } return promiseDir(fspath.dirname(fn)).then(function () { nodeFn.call(fs.writeFile, fn, headers+body); diff --git a/red/ui.js b/red/ui.js index ffd586448..d35f03368 100644 --- a/red/ui.js +++ b/red/ui.js @@ -49,7 +49,7 @@ function setupUI(settings) { if (iconCache[req.params.icon]) { res.sendfile(iconCache[req.params.icon]); } else { - for (var p in icon_paths) { + for (var p=0;p