1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Switch node: infer intent to compare numbers

Fixes #108
This commit is contained in:
Nicholas O'Leary 2013-12-06 20:26:55 +00:00
parent 4475e74187
commit d2ce6af486

View File

@ -41,6 +41,14 @@ function SwitchNode(n) {
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))) {
rule.v = Number(rule.v);
rule.v2 = Number(rule.v2);
}
}
this.on('input', function (msg) {
var onward = [];
var prop = propertyParts.reduce(function (obj, i) {