-
Notifications
You must be signed in to change notification settings - Fork 436
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
fix money validate range #815
Conversation
Would be ✨ if you write a test for it too |
@heroboy thanks for preparing this PR, it looks good to me, would you also please fix the linter issues, you can run |
@Hadis-Fard any update on this? What I need to do more? |
@heroboy Thanks for this fix! I'll try and get it merged asap! 🙇 |
this.writeInt32LE(Math.floor(value * SHIFT_RIGHT_32)); | ||
//floor(-1.9) === -2 | ||
//-1.9|0 === -1 | ||
this.writeInt32LE((value * SHIFT_RIGHT_32) | 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be simpler. I think this.writeInt32LE
is already doing the | 0
operation internally. 👍
this.writeInt32LE((value * SHIFT_RIGHT_32) | 0); | |
this.writeInt32LE(value * SHIFT_RIGHT_32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. For example: buf.writeInt32LE((0x7fffffff)+0.5)
doesn't work. The |0
is to ensure the parameter is an int
. And without this, it doesn't pass my money-type-test.
hi @arthurschreiber @Hadis-Fard
I add some integration test to test these. Hope this works. |
any update on this? If my pr is not good, I don't mind you making yours. |
@heroboy Looks like your branch is a bit out of date. Do you mind updating it, resolving the conflict and we can try to move forward with this? Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #815 +/- ##
==========================================
- Coverage 80.77% 79.51% -1.26%
==========================================
Files 86 86
Lines 4384 4403 +19
Branches 793 794 +1
==========================================
- Hits 3541 3501 -40
- Misses 584 644 +60
+ Partials 259 258 -1
Continue to review full report at Codecov.
|
Fix all. but I don't know how to fix the commit lint. |
@heroboy Thanks for updating this PR! I'm not sure how to fix the lint issues as well, but I'll ping @arthurschreiber for him to take a look at this. 🙇 |
fix #812