-
-
Notifications
You must be signed in to change notification settings - Fork 975
docs: mention template literals in fake docs #701
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #701 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1923 1923
Lines 176887 176890 +3
Branches 897 897
=======================================
+ Hits 175732 175735 +3
Misses 1099 1099
Partials 56 56
|
Co-authored-by: Leyla Jähnig <[email protected]>
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.
Some more suggestions...
@@ -17,7 +17,10 @@ export class Fake { | |||
/** | |||
* Generator method for combining faker methods based on string input. |
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.
* Generator method for combining faker methods based on string input. | |
* Generator method for combining faker methods based on static string input. |
@@ -17,7 +17,10 @@ export class Fake { | |||
/** | |||
* Generator method for combining faker methods based on string input. | |||
* | |||
* This will check the given string for placeholders and replace them by calling the specified faker method. | |||
* Note: If you just want to create a string on the fly, we recommend using string template literals instead. |
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.
* Note: If you just want to create a string on the fly, we recommend using string template literals instead. | |
* Note: If you want to create a string combining a few different faker elements, we recommend using string template literals instead of `fake`, eg. `const address = `${faker.address.zipCode} ${faker.address.city}`` |
@@ -17,7 +17,10 @@ export class Fake { | |||
/** | |||
* Generator method for combining faker methods based on string input. | |||
* | |||
* This will check the given string for placeholders and replace them by calling the specified faker method. | |||
* Note: If you just want to create a string on the fly, we recommend using string template literals instead. | |||
* This method is useful if you wish to choose a random format from a non-executable source or persistent storage (json etc.). |
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 method is useful if you wish to choose a random format from a non-executable source or persistent storage (json etc.). | |
* This method is useful though if you wish to build a random string from a static, non-executable source (eg string coming from a user, stored in a database or a file). |
Created to clarify the usage recommendations of
faker.fake()
:https://discord.com/channels/929487054990110771/957954416286261288