Bug in _counter - Increment/Decrement truncates to integer. #210
Comments
Ah, yeah that's no good. A pull request would be great, thanks! |
I put it to my existing pull request: I did the overall refactor of the _counter() function allowing the number to be of type string or number, and I also based the '+'/'-' symbol on both: operator type (increment/decrement) and amount type (positive/negative). I have internal unit tests for our product which are now passing. Please let me know if you can merge these changes to master. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When knex increment/decrement calls _counter() it uses parseInt() and truncates the incoming value to an integer. This is a problem if there is a numeric type in DB (Postgres).
I think that the _counter should do parseFloat() and if the number is given it should do nothing or just use isFinite() instead of using isNaN() that is truthy for Infinity and -Infinity.
I can provide a pull request for this one.
The text was updated successfully, but these errors were encountered: