Skip to content
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

Open
wants to merge 23 commits into
base: next
Choose a base branch
from

Conversation

soc221b
Copy link

@soc221b soc221b commented Feb 16, 2025

Adds the multipleOf option to faker.number.bigInt():

@soc221b soc221b requested a review from a team as a code owner February 16, 2025 05:33
Copy link

netlify bot commented Feb 16, 2025

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit d5379c2
🔍 Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/67badb6fd03ba50008bd8b32
😎 Deploy Preview https://deploy-preview-3402.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ST-DDT ST-DDT added c: feature Request for new feature p: 1-normal Nothing urgent m: number Something is referring to the number module labels Feb 16, 2025
@ST-DDT ST-DDT added this to the vAnytime milestone Feb 16, 2025
@ST-DDT ST-DDT requested a review from a team February 16, 2025 08:57
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.97%. Comparing base (ec7c9a8) to head (d5379c2).

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3402   +/-   ##
=======================================
  Coverage   99.97%   99.97%           
=======================================
  Files        2811     2811           
  Lines      216972   216993   +21     
  Branches      943      957   +14     
=======================================
+ Hits       216919   216940   +21     
  Misses         53       53           
Files with missing lines Coverage Δ
src/modules/number/index.ts 100.00% <100.00%> (ø)

@ST-DDT
Copy link
Member

ST-DDT commented Feb 16, 2025

Thanks for your contribution. ❤️
I'll look at it more closely soon.
Have a nice weekend

@ST-DDT
Copy link
Member

ST-DDT commented Feb 18, 2025

I finally had some time to look into you PR and run some tests locally.
I found a few cases that behave differently from the existing methods:

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.

@soc221b soc221b marked this pull request as draft February 22, 2025 04:59
@soc221b soc221b marked this pull request as ready for review February 22, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature m: number Something is referring to the number module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants