Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting msg.increment = 0, increments by 1 #21

Open
karwosts opened this issue Jan 12, 2022 · 3 comments
Open

Setting msg.increment = 0, increments by 1 #21

karwosts opened this issue Jan 12, 2022 · 3 comments

Comments

@karwosts
Copy link

karwosts commented Jan 12, 2022

If msg.increment is set to 0, the node increments by 1. I would have expected it will keep the same value.

If it is set to "0", the node increments by 0.

var increment = Number(msg.increment || 1);

0 || 1 evaluates to 1.

@prof7bit
Copy link

The same problem if msg.reset = 0, it will just ignore it. I actually haven't found any way to reset the counter to zero.

@dkern
Copy link
Owner

dkern commented Dec 14, 2022

That seems both true. I still need to look at it, sorry. For reset to it's Initial value you can use msg.reset = true;.

@BergenSoft
Copy link

0 ?? 1 would evaluate to 0
var increment = Number(msg.increment ?? 1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants