Skip to content
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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

lukaszkowalik2
Copy link
Contributor

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 like BigInt and Symbol.

Key Additions:

  • BigInt Support: The function now converts BigInt values to strings, ensuring they can be included in FormData.
  • Symbol Handling: 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:

  • Documentation: If someone could help improve the translations I’ve added for Japanese, Korean, and Simplified Chinese documentation, that would be amazing.
  • CI Testing for File: I'm having trouble getting the tests involving File 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!

Copy link

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 24, 2024 9:34am

@lukaszkowalik2 lukaszkowalik2 changed the title feat(toFormData): Added toFormData feat(toFormData): Add toFormData Oct 18, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.71%. Comparing base (626af3b) to head (d7d6df0).

Additional details and impacted files

Impacted file tree graph

@@            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     
---- 🚨 Try these New Features:

@raon0211
Copy link
Collaborator

raon0211 commented Nov 2, 2024

Let me review this weekend :)

@lukaszkowalik2
Copy link
Contributor Author

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.

@lukaszkowalik2
Copy link
Contributor Author

@raon0211 I’ve added the changes I wanted, so you can go ahead with the review whenever you’re ready. Thanks! 😃

@raon0211
Copy link
Collaborator

Thanks! This is a new function so I might need some time to think. Let me review this in a week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants