Skip to content

Instantly share code, notes, and snippets.

@geoffreydhuyvetters
Created October 10, 2015 21:31
Show Gist options
  • Save geoffreydhuyvetters/0cd8ebfbac8e7d7f1ac1 to your computer and use it in GitHub Desktop.
Save geoffreydhuyvetters/0cd8ebfbac8e7d7f1ac1 to your computer and use it in GitHub Desktop.
build form data
export const buildFormData = (form, data={}) => {
let fd = form ? new FormData(form) : new FormData();
for(let key in data){
fd.append(key, data[key]);
}
return fd;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment