Skip to content

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

Merged
merged 2 commits into from
Mar 28, 2022

Conversation

ST-DDT
Copy link
Member

@ST-DDT ST-DDT commented Mar 28, 2022

Created to clarify the usage recommendations of faker.fake():
https://discord.com/channels/929487054990110771/957954416286261288

@ST-DDT ST-DDT added the c: docs Improvements or additions to documentation label Mar 28, 2022
@ST-DDT ST-DDT requested a review from a team March 28, 2022 13:09
@ST-DDT ST-DDT self-assigned this Mar 28, 2022
@ST-DDT ST-DDT requested a review from a team as a code owner March 28, 2022 13:09
@codecov
Copy link

codecov bot commented Mar 28, 2022

Codecov Report

Merging #701 (da59866) into main (0884865) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           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           
Impacted Files Coverage Δ
src/fake.ts 100.00% <100.00%> (ø)

@ejcheng ejcheng added the p: 1-normal Nothing urgent label Mar 28, 2022
Co-authored-by: Leyla Jähnig <[email protected]>
@ST-DDT ST-DDT requested review from ejcheng, xDivisionByZerox and a team March 28, 2022 14:47
@Shinigami92 Shinigami92 merged commit 3e47440 into main Mar 28, 2022
@Shinigami92 Shinigami92 deleted the docs/fake-template-literals branch March 28, 2022 16:30
Copy link
Member

@pkuczynski pkuczynski left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: docs Improvements or additions to documentation p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants