mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Misc tidy ups of jsHint "issues" for some node-red-nodes
This commit is contained in:
parent
3644f16a89
commit
f4fdebfba5
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var RED = require(process.env.NODE_RED_HOME + "/red/red");
|
module.exports = function(RED) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function SmoothNode(n) {
|
function SmoothNode(n) {
|
||||||
RED.nodes.createNode(this, n);
|
RED.nodes.createNode(this, n);
|
||||||
this.action = n.action;
|
this.action = n.action;
|
||||||
this.round = n.round || false;
|
this.round = n.round || false;
|
||||||
@ -55,5 +56,6 @@ function SmoothNode(n) {
|
|||||||
}
|
}
|
||||||
else { node.log("Not a number: "+msg.payload); }
|
else { node.log("Not a number: "+msg.payload); }
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
RED.nodes.registerType("smooth", SmoothNode);
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("smooth", SmoothNode);
|
|
||||||
|
@ -41,9 +41,6 @@ module.exports = function(RED) {
|
|||||||
// GPIO pins 11 (R), 13 (G), 15 (B).
|
// GPIO pins 11 (R), 13 (G), 15 (B).
|
||||||
|
|
||||||
function LedBorgNode(n) {
|
function LedBorgNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
|
||||||
var node = this;
|
|
||||||
|
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.pin = n.pin;
|
this.pin = n.pin;
|
||||||
this.set = n.set || false;
|
this.set = n.set || false;
|
||||||
@ -69,10 +66,10 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else if (p3.test(msg.payload)) {
|
else if (p3.test(msg.payload)) {
|
||||||
var c = msg.payload.split(",");
|
var c = msg.payload.split(",");
|
||||||
var r = Math.floor(parseInt(c[0])*100/256).toString();
|
var r1 = Math.floor(parseInt(c[0])*100/256).toString();
|
||||||
var g = Math.floor(parseInt(c[1])*100/256).toString();
|
var g1 = Math.floor(parseInt(c[1])*100/256).toString();
|
||||||
var b = Math.floor(parseInt(c[2])*100/256).toString();
|
var b1 = Math.floor(parseInt(c[2])*100/256).toString();
|
||||||
rgb = r+","+g+","+b;
|
rgb = r1+","+g1+","+b1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// you can add fancy colours by name here if you want...
|
// you can add fancy colours by name here if you want...
|
||||||
|
@ -23,9 +23,9 @@ module.exports = function(RED) {
|
|||||||
var pre = "\\\\.\\";
|
var pre = "\\\\.\\";
|
||||||
|
|
||||||
if (!plat.match(/^win/)) {
|
if (!plat.match(/^win/)) {
|
||||||
|
pre = "";
|
||||||
throw "Info : only needed for Windows boxes without serialport npm module installed.";
|
throw "Info : only needed for Windows boxes without serialport npm module installed.";
|
||||||
//util.log("[26-rawserial.js] Info : only really needed for Windows boxes without serialport npm module installed.");
|
//util.log("[26-rawserial.js] Info : only really needed for Windows boxes without serialport npm module installed.");
|
||||||
pre = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function RawSerialInNode(n) {
|
function RawSerialInNode(n) {
|
||||||
|
@ -35,10 +35,10 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var l = JSON.stringify(msg.payload).length;
|
var le = JSON.stringify(msg.payload).length;
|
||||||
msg.payload = msgpack.encode(msg.payload);
|
msg.payload = msgpack.encode(msg.payload);
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
node.status({text:l +" o->b "+ msg.payload.length});
|
node.status({text:le +" o->b "+ msg.payload.length});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ var exifNode = require("../../../utility/exif/94-exif.js");
|
|||||||
var helper = require('../../../../node-red/test/nodes/helper.js');
|
var helper = require('../../../../node-red/test/nodes/helper.js');
|
||||||
|
|
||||||
describe('exif node', function() {
|
describe('exif node', function() {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
helper.startServer(done);
|
helper.startServer(done);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// Project configuration.
|
// Project configuration.
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
@ -51,7 +52,5 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
grunt.loadNpmTasks('grunt-lint-inline');
|
grunt.loadNpmTasks('grunt-lint-inline');
|
||||||
|
|
||||||
grunt.registerTask('default',
|
grunt.registerTask('default', ['jshint:all', 'simplemocha:all']);
|
||||||
['jshint:all', 'simplemocha:all']);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user