-
-
Notifications
You must be signed in to change notification settings - Fork 949
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(helpers): add rangeToNumber method and add range parameters #1486
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #1486 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 2216 2216
Lines 238845 238921 +76
Branches 1029 1039 +10
=======================================
+ Hits 237983 238059 +76
Misses 841 841
Partials 21 21
|
I'm feeling a bit unconfy about this change.
|
Unless you want to write your own faker functions, which applies to most of our helper functions.
I didnt touch that part in this PR. This is a task for #1349.
I can change that (use the range only in options).
Could you give me an example? |
Isn't this the same as you requested in image module? There I will also pass the faker instance just forward to the internal called function
Ah okay, I already thought that this PR is at least a part of
I was referring to this part (I originally meant not from opt to num but from num to opt): faker/src/modules/string/index.ts Lines 125 to 131 in 6bb7368
|
IMO that is a different feature. Maybe |
I don't think so or I don't know what you are referring to. If someone external wants to write his own faker method, that happens to require a range of something e.g. a custom |
I see, and I think this can then be solved on a more generic way, which indeed would then not fit anymore in this PR options = toOptions(options);
const length = toNumber(options.length ?? 1); But reading this |
Team decision
|
Done. Ready for review. |
Co-authored-by: Eric Cheng <[email protected]>
Fixes #617
helpers.rangeToNumber(numberOrRange: number | { min: number; max: number }): number