mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add "use strict" to most core nodes.
(skipping ones that may have other work in progress)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
**/
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var operators = {
|
||||
'eq': function(a, b) { return a == b; },
|
||||
'neq': function(a, b) { return a != b; },
|
||||
@@ -31,7 +32,7 @@ module.exports = function(RED) {
|
||||
'nnull': function(a) { return typeof a != "undefined"; },
|
||||
'else': function(a) { return a === true; }
|
||||
};
|
||||
|
||||
|
||||
function SwitchNode(n) {
|
||||
RED.nodes.createNode(this, n);
|
||||
this.rules = n.rules;
|
||||
@@ -39,7 +40,7 @@ module.exports = function(RED) {
|
||||
this.checkall = n.checkall || "true";
|
||||
var propertyParts = n.property.split("."),
|
||||
node = this;
|
||||
|
||||
|
||||
for (var i=0; i<this.rules.length; i+=1) {
|
||||
var rule = this.rules[i];
|
||||
if (!isNaN(Number(rule.v))) {
|
||||
@@ -47,7 +48,7 @@ module.exports = function(RED) {
|
||||
rule.v2 = Number(rule.v2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.on('input', function (msg) {
|
||||
var onward = [];
|
||||
var prop = propertyParts.reduce(function (obj, i) {
|
||||
|
@@ -15,6 +15,7 @@
|
||||
**/
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
function ChangeNode(n) {
|
||||
RED.nodes.createNode(this, n);
|
||||
this.action = n.action;
|
||||
@@ -34,7 +35,7 @@ module.exports = function(RED) {
|
||||
if (lastPart) { stem = stem[lastPart] = value; }
|
||||
return stem;
|
||||
};
|
||||
|
||||
|
||||
this.on('input', function (msg) {
|
||||
if (node.action == "change") {
|
||||
try {
|
||||
|
@@ -15,6 +15,7 @@
|
||||
**/
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
function RangeNode(n) {
|
||||
RED.nodes.createNode(this, n);
|
||||
this.action = n.action;
|
||||
@@ -24,7 +25,7 @@ module.exports = function(RED) {
|
||||
this.minout = Number(n.minout);
|
||||
this.maxout = Number(n.maxout);
|
||||
var node = this;
|
||||
|
||||
|
||||
this.on('input', function (msg) {
|
||||
var n = Number(msg.payload);
|
||||
if (!isNaN(n)) {
|
||||
|
Reference in New Issue
Block a user