Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "xfetch-js", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "node.js", |
@@ -95,3 +95,3 @@ /* | ||
? extend({ | ||
fetch: fetch.bind(window), | ||
fetch: fetch.bind(self), | ||
URL, | ||
@@ -98,0 +98,0 @@ Response, |
@@ -1,1 +0,1 @@ | ||
((a,b)=>{"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.xf=b()})(this,()=>{const a=["get","post","put","patch","delete","head"];class b extends Error{constructor(a){super(a.statusText),this.name="HTTPError",this.response=a}}class c extends Promise{}for(const a of["arrayBuffer","blob","formData","json","text"])c.prototype[a]=function(b){return this.then(b=>b[a]()).then(b||(a=>a))};const{assign:d}=Object,e=a=>a.reduce((a,[b,c])=>(a[b]=c,a),{}),f=(...a)=>b=>a.some(a=>"string"==typeof a?typeof b==a:b instanceof a),g=f("string"),h=f("object"),i=a=>g(a)||h(a),j=a=>{if(!a.ok)throw new b(a);return a},k=(h={})=>{const l=(a,b={})=>{d(b,h);const k=a=>new b.URLSearchParams(a).toString(),l=new b.URL(a,b.baseURI||void 0);if(b.headers?f(b.Headers)(b.headers)&&(b.headers=e([...b.headers.entries()])):b.headers={},b.json)b.body=JSON.stringify(b.json),b.headers["Content-Type"]="application/json";else if(i(b.urlencoded))b.body=g(b.urlencoded)?b.urlencoded:k(b.urlencoded),b.headers["Content-Type"]="application/x-www-form-urlencoded";else if(f(b.FormData,"object")(b.formData)){if(!f(b.FormData)(b.formData)){const a=new b.FormData;for(const[c,d]of Object.entries(b.formData))a.append(c,d);b.formData=a}b.body=b.formData}return b.qs&&(g(b.qs)&&(b.qs=(a=>e([...new b.URLSearchParams(a).entries()]))(b.qs)),l.search=k(d(e([...l.searchParams.entries()]),b.qs))),b.credentials||(b.credentials="same-origin"),c.resolve(b.fetch(l,b).then(j))};for(const b of a)l[b]=(a,c={})=>(c.method=b.toUpperCase(),l(a,c));return l.extend=a=>k(d({},h,a)),l.HTTPError=b,l},l="undefined"!=typeof self;return l?k({fetch:fetch.bind(window),URL,Response,URLSearchParams,Headers,FormData,baseURI:document?document.baseURI:""}):k()}); | ||
((a,b)=>{"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.xf=b()})(this,()=>{const a=["get","post","put","patch","delete","head"];class b extends Error{constructor(a){super(a.statusText),this.name="HTTPError",this.response=a}}class c extends Promise{}for(const a of["arrayBuffer","blob","formData","json","text"])c.prototype[a]=function(b){return this.then(b=>b[a]()).then(b||(a=>a))};const{assign:d}=Object,e=a=>a.reduce((a,[b,c])=>(a[b]=c,a),{}),f=(...a)=>b=>a.some(a=>"string"==typeof a?typeof b==a:b instanceof a),g=f("string"),h=f("object"),i=a=>g(a)||h(a),j=a=>{if(!a.ok)throw new b(a);return a},k=(h={})=>{const l=(a,b={})=>{d(b,h);const k=a=>new b.URLSearchParams(a).toString(),l=new b.URL(a,b.baseURI||void 0);if(b.headers?f(b.Headers)(b.headers)&&(b.headers=e([...b.headers.entries()])):b.headers={},b.json)b.body=JSON.stringify(b.json),b.headers["Content-Type"]="application/json";else if(i(b.urlencoded))b.body=g(b.urlencoded)?b.urlencoded:k(b.urlencoded),b.headers["Content-Type"]="application/x-www-form-urlencoded";else if(f(b.FormData,"object")(b.formData)){if(!f(b.FormData)(b.formData)){const a=new b.FormData;for(const[c,d]of Object.entries(b.formData))a.append(c,d);b.formData=a}b.body=b.formData}return b.qs&&(g(b.qs)&&(b.qs=(a=>e([...new b.URLSearchParams(a).entries()]))(b.qs)),l.search=k(d(e([...l.searchParams.entries()]),b.qs))),b.credentials||(b.credentials="same-origin"),c.resolve(b.fetch(l,b).then(j))};for(const b of a)l[b]=(a,c={})=>(c.method=b.toUpperCase(),l(a,c));return l.extend=a=>k(d({},h,a)),l.HTTPError=b,l},l="undefined"!=typeof self;return l?k({fetch:fetch.bind(self),URL,Response,URLSearchParams,Headers,FormData,baseURI:document?document.baseURI:""}):k()}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16274