-
Notifications
You must be signed in to change notification settings - Fork 329
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(toFormData): Add toFormData
#726
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
toFormData
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #726 +/- ##
==========================================
- Coverage 99.74% 99.71% -0.04%
==========================================
Files 311 312 +1
Lines 2791 2838 +47
Branches 830 857 +27
==========================================
+ Hits 2784 2830 +46
- Misses 7 8 +1
|
Let me review this weekend :) |
Hold off on reviewing this for now. I'm going to refactor it a bit and add some configuration to it. Then I'll make another PR after you (hopefully) accept this one. After that, I'll add a function called fromFormData to convert FormData to an object. |
@raon0211 I’ve added the changes I wanted, so you can go ahead with the review whenever you’re ready. Thanks! 😃 |
Thanks! This is a new function so I might need some time to think. Let me review this in a week. |
I’ve added the
toFormData
function to the library. The initial idea was inspired by the object-to-formdata project. I’ve expanded on that project by adding support for additional JavaScript data types likeBigInt
andSymbol
.Key Additions:
BigInt
values to strings, ensuring they can be included inFormData
.Symbol
values will throw an error, as they cannot be serialized.Additionally, I attempted to make the function more type-safe, but due to the limitations outlined in this TypeScript issue, it’s not yet possible to implement a fully generic type-safe version of
FormData
.Request for Help:
File
: I'm having trouble getting the tests involvingFile
to work in a CI environment. Any guidance on how to resolve this would be greatly appreciated!Thanks in advance to anyone who can assist!