fix random number returning strings !

This commit is contained in:
Dave Conway-Jones 2021-01-05 22:12:21 +00:00
parent fa2ea96e67
commit 00fbae3ef6
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 56 additions and 56 deletions

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-random",
"version" : "0.3.0",
"version" : "0.3.1",
"description" : "A Node-RED node that when triggered generates a random number between two values.",
"dependencies" : {
},

View File

@ -16,7 +16,7 @@ module.exports = function(RED) {
tmp.low = 1 // set this as the default low value
tmp.low_e = ""
if (node.low) { // if the the node has a value use it
tmp.low = node.low
tmp.low = Number(node.low);
} else if ('from' in msg) { // else see if a 'from' is in the msg
if (Number(msg.from)) { // if it is, and is a number, use it
tmp.low = Number(msg.from);
@ -29,7 +29,7 @@ module.exports = function(RED) {
tmp.high = 10 // set this as the default high value
tmp.high_e = "";
if (node.high) { // if the the node has a value use it
tmp.high = node.high
tmp.high = Number(node.high);
} else if ('to' in msg) { // else see if a 'to' is in the msg
if (Number(msg.to)) { // if it is, and is a number, use it
tmp.high = Number(msg.to);