Created
December 2, 2018 16:26
-
-
Save pirey/3b353db4a0cd92c5ac9a892ef47e1653 to your computer and use it in GitHub Desktop.
Collection of javascript helper functions
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
// convert FormData to Object | |
export const fd2obj = (fd) => Array.from(fd.entries()).reduce((acc, i) => Object.assign({}, acc, { [i[0]]: (acc[i[0]] || Array.isArray(acc[i[0]])) ? [].concat(acc[i[0]]).concat(i[1]) : i[1] }), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment