From e82f620cd81cbbfd05d8931539f63b115505f2a9 Mon Sep 17 00:00:00 2001 From: juggledad Date: Mon, 18 Mar 2019 06:32:19 -0400 Subject: [PATCH] the RESET 'if' is incorrect the reset if will fail it msg.reset is a zero because msg.reset will evaluate to FALSE. This change will check to see if msg.reset is a number and then continue if it is. --- counter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/counter.js b/counter.js index 0ca4b31..b5e9f20 100644 --- a/counter.js +++ b/counter.js @@ -65,7 +65,7 @@ module.exports = function(RED) { } // handle reset - if( msg.hasOwnProperty("reset") && msg.reset ) { + if( msg.hasOwnProperty("reset") && typeof msg.reset === "number" ) { node.count = typeof msg.reset === "number" ? msg.reset : node.init; } @@ -122,4 +122,4 @@ module.exports = function(RED) { } RED.nodes.registerType("counter", counter); -}; \ No newline at end of file +};