Created
January 31, 2021 18:41
-
-
Save tlux/c4c2e3e49327043124d29036dc6ba82e to your computer and use it in GitHub Desktop.
FormData to object (Typescript)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function formDataToObject(formData: FormData): Record<string, FormDataEntryValue> { | |
| const data: Record<string, FormDataEntryValue> = {}; | |
| for (let [key, value] of formData.entries()) { | |
| data[key] = value; | |
| } | |
| return data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment