Last active
April 30, 2019 20:37
-
-
Save petermoresi/703b80178e787e283194ded3dce447d3 to your computer and use it in GitHub Desktop.
This file contains 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
let formData = new FormData(); | |
formData.append("name", "Tom"); | |
[...formData.keys()].reduce((acc, key) => ({ ...acc, [`${key}`]: formData.get(key) }), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This ES6 code can be used to convert any GeneratorFunction into a regular JS Object.