UNPKG

wretch

Version:

A tiny wrapper built around fetch with an intuitive syntax.

2 lines 490 B
function e(t,n=!1,r=new FormData,i=[]){return Object.entries(t).forEach(([t,a])=>{let o=i.reduce((e,t)=>e?`${e}[${t}]`:t,null);if(o=o?`${o}[${t}]`:t,a instanceof Array||globalThis.FileList&&a instanceof FileList)for(let e of a)r.append(o,e);else n&&typeof a==`object`&&(!(n instanceof Array)||!n.includes(t))?a!==null&&e(a,n,r,[...i,t]):r.append(o,a)}),r}const t={wretch:{formData(t,n={}){return this.body(e(t,n.recursive??!1))}}};module.exports=t; //# sourceMappingURL=formData.min.cjs.map