wretch
Version:
A tiny wrapper built around fetch with an intuitive syntax.
3 lines (2 loc) • 742 B
JavaScript
var global,factory;global=this,factory=function(){function t(t){return void 0!==t?t:""}const e=(e,o,n,r)=>{let f;if("string"==typeof o)f=o;else{const e=r.polyfill("URLSearchParams",1,1);for(const n in o){const r=o[n];if(o[n]instanceof Array)for(const o of r)e.append(n,t(o));else e.append(n,t(r))}f=e.toString()}const i=e.split("?");return f?n||i.length<2?i[0]+"?"+f:e+"&"+f:n?i[0]:e};return{wretch:{query(t,o=0){return{...this,_url:e(this._url,t,o,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).wretchQueryStringAddon=factory();
//# sourceMappingURL=queryString.min.js.map