File tree 3 files changed +169
-131
lines changed
3 files changed +169
-131
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " node-red-node-random" ,
3
- "version" : " 0.4.0 " ,
3
+ "version" : " 0.4.1 " ,
4
4
"description" : " A Node-RED node that when triggered generates a random number between two values." ,
5
5
"dependencies" : {
6
6
},
Original file line number Diff line number Diff line change @@ -18,9 +18,8 @@ module.exports = function(RED) {
18
18
if ( node . low ) { // if the the node has a value use it
19
19
tmp . low = Number ( node . low ) ;
20
20
} else if ( 'from' in msg ) { // else see if a 'from' is in the msg
21
- if ( Number ( msg . from ) ) { // if it is, and is a number, use it
22
- tmp . low = Number ( msg . from ) ;
23
- } else { // otherwise setup NaN error
21
+ tmp . low = Number ( msg . from ) ;
22
+ if ( isNaN ( msg . from ) ) { // if it isn't a number setup NaN error
24
23
tmp . low = NaN ;
25
24
tmp . low_e = " From: " + msg . from ; // setup to show bad incoming msg.from
26
25
}
@@ -31,9 +30,8 @@ module.exports = function(RED) {
31
30
if ( node . high ) { // if the the node has a value use it
32
31
tmp . high = Number ( node . high ) ;
33
32
} else if ( 'to' in msg ) { // else see if a 'to' is in the msg
34
- if ( Number ( msg . to ) ) { // if it is, and is a number, use it
35
- tmp . high = Number ( msg . to ) ;
36
- } else { // otherwise setup NaN error
33
+ tmp . high = Number ( msg . to ) ;
34
+ if ( isNaN ( msg . to ) ) { // if it isn't a number setup NaN error
37
35
tmp . high = NaN
38
36
tmp . high_e = " To: " + msg . to // setup to show bad incoming msg.to
39
37
}
You can’t perform that action at this time.
0 commit comments