-
-
Notifications
You must be signed in to change notification settings - Fork 932
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(finance): use fake patterns for transactionDescription #3202
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3202 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 2806 2807 +1
Lines 217076 217087 +11
Branches 964 966 +2
=======================================
+ Hits 216997 217008 +11
Misses 79 79
|
If you still need the method, please inline/copy the implementation: transactionDescription(): string {
const amount = faker.finance.amount();
const company = faker.company.name();
const transactionType = faker.finance.transactionType();
const account = faker.finance.accountNumber();
const card = faker.finance.creditCardNumber().replaceAll(/(?<=.{4}).(?=.{2})/g, '*');
const currency = faker.finance.currencyCode();
return `${transactionType} transaction at ${company} using card ending with ***${card} for ${currency} ${amount} in account ***${account}`;
} |
A quick GH search says otherwise 🤔
I actually kind of agree with you here. BUT:
Having this method in our codebase doesn't cause a big enought pain point to call for emidiate action in my opinion. |
I tend to agree this doesnt cause any harm and should be left alone. Perhaps we could add a note this is discouraged for new code without formally deprecating it. |
The method only produces English output and isn't usable outside of the English locale.
Note: I'm not against soft-deprecating this method, I just wanted to raise awareness of this fact. If we go for soft-deprecation, how about a text like this:
|
Or alternatively, we convert it to a proper localized method. |
Team Decision
|
338c778
to
c7b2116
Compare
c7b2116
to
4daf6c6
Compare
4daf6c6
to
f95c4b4
Compare
Ready for review. |
This PR changes the
faker.finance.transactionDescription()
method to use fake patterns instead of a hard coded string.Popularity-Data from #3215
faker.finance.transactionDescription
: 20