-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
feat(number): bigint multipleOf #3402
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3402 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 2811 2811
Lines 216972 216982 +10
Branches 944 951 +7
=======================================
+ Hits 216917 216929 +12
+ Misses 55 53 -2
|
Thanks for your contribution. ❤️ |
I finally had some time to look into you PR and run some tests locally. faker.number.int({ 'min': 6, 'max': 9, 'multipleOf': 5 }) // Error: No suitable integer value between 6 and 9 found.
faker.number.bigInt({ 'min': 6, 'max': 9, 'multipleOf': 5 }) // 10 faker.number.int({ 'min': -9, 'max': 0, 'multipleOf': 5 }) // -5
faker.number.bigInt({ 'min': -9, 'max': 0, 'multipleOf': 5 }) // Error: Multiple of 5n should be less than or equal to max 0n. Please fix these cases and add tests for them. |
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.
Sorry, for the slow review. It looks good to me, just a few suggestions to make it easier to read.
const delta = max - min; | ||
if (effectiveMax < effectiveMin) { | ||
throw new FakerError( | ||
`No suitable bigint value between ${min} and ${max} found.` |
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.
@faker-js/maintainers @faker-js/members
Not sure about this one. BigInt
or bigint
?
`No suitable bigint value between ${min} and ${max} found.` | |
`No suitable BigInt value between ${min} and ${max} found.` |
If we change it here, we should also change it in the jsdocs above.
Thank you for your review. I have made the changes you suggested. |
Adds the
multipleOf
option tofaker.number.bigInt()
: