wretch
Version:
A tiny wrapper built around fetch with an intuitive syntax.
3 lines (2 loc) • 719 B
JavaScript
var global,factory;global=this,factory=function(){function e(o,t=0,n,f=n.polyfill("FormData",1,1),r=[]){return Object.entries(o).forEach((([o,a])=>{let l=r.reduce(((e,o)=>e?`${e}[${o}]`:o),null);if(l=l?`${l}[${o}]`:o,a instanceof Array)for(const e of a)f.append(l,e);else!t||"object"!=typeof a||t instanceof Array&&t.includes(o)?f.append(l,a):null!==a&&e(a,t,n,f,[...r,o])})),f}return{wretch:{formData(o,t=0){return this.body(e(o,t,this._config))}}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):(global="undefined"!=typeof globalThis?globalThis:global||self).wretchFormDataAddon=factory();
//# sourceMappingURL=formData.min.js.map