-
-
Notifications
You must be signed in to change notification settings - Fork 939
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(image): add image dataUri with base64 #2273
Conversation
…ontaining a base64 image to image.dataUri
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #2273 +/- ##
==========================================
- Coverage 99.61% 99.60% -0.01%
==========================================
Files 2774 2774
Lines 251763 251780 +17
Branches 1083 1082 -1
==========================================
+ Hits 250783 250788 +5
- Misses 953 965 +12
Partials 27 27
|
…base64') because it is available in node-14 and can handle characters beyond the ASCII range
There seems to be merge conflicts. Could you please fix them? |
Sorry for the late reply. I fixed the merge conflicts. |
Team decision: We accept this feature. This can now be reviewed. |
I just noticed, that Blocked by: |
We added some (forgotten) seeded tests to ensure the values generated by this method are reproducible. faker/test/modules/image.spec.ts Lines 71 to 82 in b468d5f
|
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.
Sorry, for all the back and forth.
Adds a image type parameter
type
tofaker.image.dataUri
.If
type
equals'svg'
, it returns a URI that contains a svg image as before.If
type
equals'base64'
, it returns a URI that contains a base64 image as described in #1550.Currently the base64 image is generated by converting a svg image. I am not sure, if that is an issue. As @matthewmayer pointed out in the issue, it would probably bloat the code if it should also return a base64 encoded jpg or png.
Additionally I added a few tests for the new parameter similar to the ones that already existed.
Closes #1550.