-
-
Notifications
You must be signed in to change notification settings - Fork 930
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
Standardize function parameters and defaults #1349
Comments
Blocked by #1346 |
Is the faker/src/modules/lorem/index.ts Lines 106 to 119 in fccd641
I'm not sure what to do here. |
I was going to add a section to the migration guide about these changes, but to clarify is it intended that the non-options-object parameters will be deprecated in v8 and removed in v9? Or will both versions be supported in v8+? |
TLDR; So yes, some of the signatures will be deprecated in v8 and removed in v9. So they are usable for v8.x. But most of them simply get standardized into an options object and can be used even after v9.
No, not entirely. Primitive arguments are often desired for configuring the parameter which is most likely to be used the most by users. For example: faker.number.int(10); // number between 0 and 10
faker.number.int({ max: 10 }); // number between 0 and 10
faker.number.int({ max: 10, min: 10 }); // number between 0 and 10 As you can see, all functions do exactly the same, but the biggest use-case for The downside of primitives is that they are hard to maintain. You can extend signatures by always adding an additional parameter at the end (example
|
Team Decision We will rewrite the lorem methods to support options. |
It seems we have tackled all needed changes. If we want to change something additionally, we should open issues/PRs specifically. |
Clear and concise description of the problem
Most methods have various ways to specify parameters and have different defaults.
Suggested solution
All methods should be checked that they have:
The consistency should span across all modules.
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: