Closed chrismoos closed 6 years ago
Thanks for the contrib... but not sure what it's meant to resolve... parseInt will auto remove all leading zeros... http://jsbin.com/varamekiwu/edit?js,console
What led you to believe that the zone wasn't being set right?
In some version of javascript, parseInt(08)
will be attempted to parse as an octal number as opposed to a decimal number.
@chrismoos, can you test if the following fixes your problem?
msg.userOrZone = parseInt(map[2], 10);
I highly recommend to always pass in the radix to prevent confusion. I think the jsbin behaves correctly because it's being run in a modern browser.
@peaches yeah, it seems that was the issue, simpler than the fix I added. I've updated the change to pass the radix.
@redloro On older versions of node like 0.6.x, it doesn't parse the zone number correctly, see the following:
$ node
> parseInt('08')
0
> parseInt('08', 10)
8
> $ node -v
v0.6.12
I noticed an issue with zones < 10 not generating open/closed events properly. This is because
parseInt
parses a zone like08
as zero.