Closed severus-sn4pe closed 3 years ago
read bits does modify state - there may be a way to clean this up, but the stateful consumption of bits off of the bitStream always ends up being a little gross - it's the most stateful portion of a generally pretty stateless codebase.
Would welcome a PR if you were interested in making this more intuitive, but as it's not an actual bug I'm going to close the issue.
In
decode()
, the twoelse if
condition blocks on lines 972-983 have the same condition as theif
block at L966.https://github.com/cozmo/jsQR/blob/8851ab5cc5fecd646be668ccd34612ccc236d9c3/dist/jsQR.js#L966-L983
This smells like a bug. or does
readBits()
somehow modify the state and this works as intended? Anyway, it looks strange for sure.