Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@36node/fetch

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@36node/fetch - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.6.5](https://github.com/36node/sketch/compare/@36node/fetch@0.6.4...@36node/fetch@0.6.5) (2020-12-29)
### Bug Fixes
* **fetch:** query string use import instead of require ([20dbd02](https://github.com/36node/sketch/commit/20dbd02))
## [0.6.4](https://github.com/36node/sketch/compare/@36node/fetch@0.6.3...@36node/fetch@0.6.4) (2019-10-14)

@@ -8,0 +19,0 @@

2

dist/browser.js

@@ -1,2 +0,2 @@

var e,t=(e=require("wxapp-http"))&&"object"==typeof e&&"default"in e?e.default:e,r=(require("decode-uri-component"),function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})});function n(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}var o=t.create({maxConcurrent:10,timeout:0,header:{},dataType:"json"});function a(e){var t=e.header||{};return{ok:1==(e.statusCode/200|0),status:e.statusCode,statusText:e.errMsg,url:(e.config||{}).url,clone:function(){return a(e)},text:function(){return Promise.resolve("string"==typeof e.data?e.data:JSON.stringify(e.data))},json:function(){if("object"==typeof e.data)return Promise.resolve(e.data);var t={};try{t=JSON.parse(e.data)}catch(e){console.error(e)}return t},blob:function(){return Promise.resolve(new Blob([e.data]))},headers:{keys:function(){return Object.keys(t)},entries:function(){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push([r,t[r]]);return e},get:function(e){var r=Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()});return t[r]},has:function(e){return!!Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()})},forEach:function(e){for(var r in t)t.hasOwnProperty(r)&&e([t[r],r])}}}}var u="function"==typeof fetch?fetch.bind():function(e,t){return o.request((t=t||{}).method||"get",e,t.body,t.headers).then(function(e){return Promise.resolve(a(e))}).catch(function(e){return Promise.reject(a(e))})};!window&&wx&&(global.fetch=u,global.Response=u.Response,global.Headers=u.Headers,global.Request=u.Request),module.exports=function(e,t){void 0===t&&(t={});try{var r=t.body,o=t.headers;void 0===o&&(o={});var a=function(e,t){if(!e)return"";var r=function(e){switch(e.arrayFormat){case"index":return function(t,r,o){return null===r?[n(t,e),"[",o,"]"].join(""):[n(t,e),"[",n(o,e),"]=",n(r,e)].join("")};case"bracket":return function(t,r){return null===r?[n(t,e),"[]"].join(""):[n(t,e),"[]=",n(r,e)].join("")};default:return function(t,r){return null===r?n(t,e):[n(t,e),"=",n(r,e)].join("")}}}(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)),o=Object.keys(e);return!1!==t.sort&&o.sort(t.sort),o.map(function(o){var a=e[o];if(void 0===a)return"";if(null===a)return n(o,t);if(Array.isArray(a)){for(var u=[],i=0,s=a.slice();i<s.length;i+=1){var c=s[i];void 0!==c&&u.push(r(o,c,u.length))}return u.join("&")}return n(o,t)+"="+n(a,t)}).filter(function(e){return e.length>0}).join("&")}(t.query,{skipNulls:!0}),u=a?e+"?"+a:e;r&&(r=JSON.stringify(r)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var i=global&&global.fetch||window&&window.fetch;return Promise.resolve(i(u,Object.assign({},t,{body:r,headers:o}))).then(function(e){function t(){if(!e.ok)throw Object.assign({},r.body,{status:e.status});return e.headers.forEach(function(e,t){return r.headers[t]=e}),r}if("No Content"===e.statusText)return{};var r={headers:{}},n=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){r.body=e}):Promise.resolve(e.text()).then(function(e){r.body={message:e}});return n&&n.then?n.then(t):t()})}catch(e){return Promise.reject(e)}};
require("decode-uri-component");var e,t=(e=require("wxapp-http"))&&"object"==typeof e&&"default"in e?e.default:e,r=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function n(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}var o=t.create({maxConcurrent:10,timeout:0,header:{},dataType:"json"});function a(e){var t=e.header||{};return{ok:1==(e.statusCode/200|0),status:e.statusCode,statusText:e.errMsg,url:(e.config||{}).url,clone:function(){return a(e)},text:function(){return Promise.resolve("string"==typeof e.data?e.data:JSON.stringify(e.data))},json:function(){if("object"==typeof e.data)return Promise.resolve(e.data);var t={};try{t=JSON.parse(e.data)}catch(e){console.error(e)}return t},blob:function(){return Promise.resolve(new Blob([e.data]))},headers:{keys:function(){return Object.keys(t)},entries:function(){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push([r,t[r]]);return e},get:function(e){var r=Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()});return t[r]},has:function(e){return!!Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()})},forEach:function(e){for(var r in t)t.hasOwnProperty(r)&&e([t[r],r])}}}}var u="function"==typeof fetch?fetch.bind():function(e,t){return o.request((t=t||{}).method||"get",e,t.body,t.headers).then(function(e){return Promise.resolve(a(e))}).catch(function(e){return Promise.reject(a(e))})};!window&&wx&&(global.fetch=u,global.Response=u.Response,global.Headers=u.Headers,global.Request=u.Request),module.exports=function(e,t){void 0===t&&(t={});try{var r=t.body,o=t.headers;void 0===o&&(o={});var a=function(e,t){if(!e)return"";var r=function(e){switch(e.arrayFormat){case"index":return function(t,r,o){return null===r?[n(t,e),"[",o,"]"].join(""):[n(t,e),"[",n(o,e),"]=",n(r,e)].join("")};case"bracket":return function(t,r){return null===r?[n(t,e),"[]"].join(""):[n(t,e),"[]=",n(r,e)].join("")};default:return function(t,r){return null===r?n(t,e):[n(t,e),"=",n(r,e)].join("")}}}(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)),o=Object.keys(e);return!1!==t.sort&&o.sort(t.sort),o.map(function(o){var a=e[o];if(void 0===a)return"";if(null===a)return n(o,t);if(Array.isArray(a)){for(var u=[],i=0,s=a.slice();i<s.length;i+=1){var c=s[i];void 0!==c&&u.push(r(o,c,u.length))}return u.join("&")}return n(o,t)+"="+n(a,t)}).filter(function(e){return e.length>0}).join("&")}(t.query,{skipNulls:!0}),u=a?e+"?"+a:e;r&&(r=JSON.stringify(r)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var i=global&&global.fetch||window&&window.fetch;return Promise.resolve(i(u,Object.assign({},t,{body:r,headers:o}))).then(function(e){function t(){if(!e.ok)throw Object.assign({},r.body,{status:e.status});return e.headers.forEach(function(e,t){return r.headers[t]=e}),r}if("No Content"===e.statusText)return{};var r={headers:{}},n=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){r.body=e}):Promise.resolve(e.text()).then(function(e){r.body={message:e}});return n&&n.then?n.then(t):t()})}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=browser.js.map

@@ -1,2 +0,2 @@

import e from"wxapp-http";require("decode-uri-component");var t=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function r(e,r){return r.encode?r.strict?t(e):encodeURIComponent(e):e}var n=e.create({maxConcurrent:10,timeout:0,header:{},dataType:"json"});function o(e){var t=e.header||{};return{ok:1==(e.statusCode/200|0),status:e.statusCode,statusText:e.errMsg,url:(e.config||{}).url,clone:function(){return o(e)},text:function(){return Promise.resolve("string"==typeof e.data?e.data:JSON.stringify(e.data))},json:function(){if("object"==typeof e.data)return Promise.resolve(e.data);var t={};try{t=JSON.parse(e.data)}catch(e){console.error(e)}return t},blob:function(){return Promise.resolve(new Blob([e.data]))},headers:{keys:function(){return Object.keys(t)},entries:function(){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push([r,t[r]]);return e},get:function(e){var r=Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()});return t[r]},has:function(e){return!!Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()})},forEach:function(e){for(var r in t)t.hasOwnProperty(r)&&e([t[r],r])}}}}var a="function"==typeof fetch?fetch.bind():function(e,t){return n.request((t=t||{}).method||"get",e,t.body,t.headers).then(function(e){return Promise.resolve(o(e))}).catch(function(e){return Promise.reject(o(e))})};!window&&wx&&(global.fetch=a,global.Response=a.Response,global.Headers=a.Headers,global.Request=a.Request);export default function(e,t){void 0===t&&(t={});try{var n=t.body,o=t.headers;void 0===o&&(o={});var a=function(e,t){if(!e)return"";var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,o){return null===n?[r(t,e),"[",o,"]"].join(""):[r(t,e),"[",r(o,e),"]=",r(n,e)].join("")};case"bracket":return function(t,n){return null===n?[r(t,e),"[]"].join(""):[r(t,e),"[]=",r(n,e)].join("")};default:return function(t,n){return null===n?r(t,e):[r(t,e),"=",r(n,e)].join("")}}}(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)),o=Object.keys(e);return!1!==t.sort&&o.sort(t.sort),o.map(function(o){var a=e[o];if(void 0===a)return"";if(null===a)return r(o,t);if(Array.isArray(a)){for(var i=[],s=0,u=a.slice();s<u.length;s+=1){var c=u[s];void 0!==c&&i.push(n(o,c,i.length))}return i.join("&")}return r(o,t)+"="+r(a,t)}).filter(function(e){return e.length>0}).join("&")}(t.query,{skipNulls:!0}),i=a?e+"?"+a:e;n&&(n=JSON.stringify(n)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var s=global&&global.fetch||window&&window.fetch;return Promise.resolve(s(i,Object.assign({},t,{body:n,headers:o}))).then(function(e){function t(){if(!e.ok)throw Object.assign({},r.body,{status:e.status});return e.headers.forEach(function(e,t){return r.headers[t]=e}),r}if("No Content"===e.statusText)return{};var r={headers:{}},n=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){r.body=e}):Promise.resolve(e.text()).then(function(e){r.body={message:e}});return n&&n.then?n.then(t):t()})}catch(e){return Promise.reject(e)}}
import"decode-uri-component";import e from"wxapp-http";var t=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function r(e,r){return r.encode?r.strict?t(e):encodeURIComponent(e):e}var n=e.create({maxConcurrent:10,timeout:0,header:{},dataType:"json"});function o(e){var t=e.header||{};return{ok:1==(e.statusCode/200|0),status:e.statusCode,statusText:e.errMsg,url:(e.config||{}).url,clone:function(){return o(e)},text:function(){return Promise.resolve("string"==typeof e.data?e.data:JSON.stringify(e.data))},json:function(){if("object"==typeof e.data)return Promise.resolve(e.data);var t={};try{t=JSON.parse(e.data)}catch(e){console.error(e)}return t},blob:function(){return Promise.resolve(new Blob([e.data]))},headers:{keys:function(){return Object.keys(t)},entries:function(){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push([r,t[r]]);return e},get:function(e){var r=Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()});return t[r]},has:function(e){return!!Object.keys(t).find(function(t){return t.toLowerCase()===e.toLowerCase()})},forEach:function(e){for(var r in t)t.hasOwnProperty(r)&&e([t[r],r])}}}}var a="function"==typeof fetch?fetch.bind():function(e,t){return n.request((t=t||{}).method||"get",e,t.body,t.headers).then(function(e){return Promise.resolve(o(e))}).catch(function(e){return Promise.reject(o(e))})};!window&&wx&&(global.fetch=a,global.Response=a.Response,global.Headers=a.Headers,global.Request=a.Request);export default function(e,t){void 0===t&&(t={});try{var n=t.body,o=t.headers;void 0===o&&(o={});var a=function(e,t){if(!e)return"";var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,o){return null===n?[r(t,e),"[",o,"]"].join(""):[r(t,e),"[",r(o,e),"]=",r(n,e)].join("")};case"bracket":return function(t,n){return null===n?[r(t,e),"[]"].join(""):[r(t,e),"[]=",r(n,e)].join("")};default:return function(t,n){return null===n?r(t,e):[r(t,e),"=",r(n,e)].join("")}}}(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)),o=Object.keys(e);return!1!==t.sort&&o.sort(t.sort),o.map(function(o){var a=e[o];if(void 0===a)return"";if(null===a)return r(o,t);if(Array.isArray(a)){for(var i=[],s=0,u=a.slice();s<u.length;s+=1){var c=u[s];void 0!==c&&i.push(n(o,c,i.length))}return i.join("&")}return r(o,t)+"="+r(a,t)}).filter(function(e){return e.length>0}).join("&")}(t.query,{skipNulls:!0}),i=a?e+"?"+a:e;n&&(n=JSON.stringify(n)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var s=global&&global.fetch||window&&window.fetch;return Promise.resolve(s(i,Object.assign({},t,{body:n,headers:o}))).then(function(e){function t(){if(!e.ok)throw Object.assign({},r.body,{status:e.status});return e.headers.forEach(function(e,t){return r.headers[t]=e}),r}if("No Content"===e.statusText)return{};var r={headers:{}},n=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){r.body=e}):Promise.resolve(e.text()).then(function(e){r.body={message:e}});return n&&n.then?n.then(t):t()})}catch(e){return Promise.reject(e)}}
//# sourceMappingURL=browser.m.js.map

@@ -1,2 +0,2 @@

var e,n=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e,t=(require("decode-uri-component"),function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})});function r(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}global.fetch||(global.fetch=n,global.Response=n.Response,global.Headers=n.Headers,global.Request=n.Request),module.exports=function(e,n){void 0===n&&(n={});try{var t=n.body,o=n.headers;void 0===o&&(o={});var i=function(e,n){if(!e)return"";var t=function(e){switch(e.arrayFormat){case"index":return function(n,t,o){return null===t?[r(n,e),"[",o,"]"].join(""):[r(n,e),"[",r(o,e),"]=",r(t,e)].join("")};case"bracket":return function(n,t){return null===t?[r(n,e),"[]"].join(""):[r(n,e),"[]=",r(t,e)].join("")};default:return function(n,t){return null===t?r(n,e):[r(n,e),"=",r(t,e)].join("")}}}(n=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},n)),o=Object.keys(e);return!1!==n.sort&&o.sort(n.sort),o.map(function(o){var i=e[o];if(void 0===i)return"";if(null===i)return r(o,n);if(Array.isArray(i)){for(var s=[],u=0,a=i.slice();u<a.length;u+=1){var c=a[u];void 0!==c&&s.push(t(o,c,s.length))}return s.join("&")}return r(o,n)+"="+r(i,n)}).filter(function(e){return e.length>0}).join("&")}(n.query,{skipNulls:!0}),s=i?e+"?"+i:e;t&&(t=JSON.stringify(t)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var u=global&&global.fetch||window&&window.fetch;return Promise.resolve(u(s,Object.assign({},n,{body:t,headers:o}))).then(function(e){function n(){if(!e.ok)throw Object.assign({},t.body,{status:e.status});return e.headers.forEach(function(e,n){return t.headers[n]=e}),t}if("No Content"===e.statusText)return{};var t={headers:{}},r=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){t.body=e}):Promise.resolve(e.text()).then(function(e){t.body={message:e}});return r&&r.then?r.then(n):n()})}catch(e){return Promise.reject(e)}};
var e,n=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e;require("decode-uri-component");var t=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function r(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}global.fetch||(global.fetch=n,global.Response=n.Response,global.Headers=n.Headers,global.Request=n.Request),module.exports=function(e,n){void 0===n&&(n={});try{var t=n.body,o=n.headers;void 0===o&&(o={});var i=function(e,n){if(!e)return"";var t=function(e){switch(e.arrayFormat){case"index":return function(n,t,o){return null===t?[r(n,e),"[",o,"]"].join(""):[r(n,e),"[",r(o,e),"]=",r(t,e)].join("")};case"bracket":return function(n,t){return null===t?[r(n,e),"[]"].join(""):[r(n,e),"[]=",r(t,e)].join("")};default:return function(n,t){return null===t?r(n,e):[r(n,e),"=",r(t,e)].join("")}}}(n=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},n)),o=Object.keys(e);return!1!==n.sort&&o.sort(n.sort),o.map(function(o){var i=e[o];if(void 0===i)return"";if(null===i)return r(o,n);if(Array.isArray(i)){for(var a=[],s=0,u=i.slice();s<u.length;s+=1){var c=u[s];void 0!==c&&a.push(t(o,c,a.length))}return a.join("&")}return r(o,n)+"="+r(i,n)}).filter(function(e){return e.length>0}).join("&")}(n.query,{skipNulls:!0}),a=i?e+"?"+i:e;t&&(t=JSON.stringify(t)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var s=global&&global.fetch||window&&window.fetch;return Promise.resolve(s(a,Object.assign({},n,{body:t,headers:o}))).then(function(e){function n(){if(!e.ok)throw Object.assign({},t.body,{status:e.status});return e.headers.forEach(function(e,n){return t.headers[n]=e}),t}if("No Content"===e.statusText)return{};var t={headers:{}},r=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){t.body=e}):Promise.resolve(e.text()).then(function(e){t.body={message:e}});return r&&r.then?r.then(n):n()})}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import e from"node-fetch";require("decode-uri-component");var n=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function t(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}global.fetch||(global.fetch=e,global.Response=e.Response,global.Headers=e.Headers,global.Request=e.Request);export default function(e,n){void 0===n&&(n={});try{var r=n.body,o=n.headers;void 0===o&&(o={});var i=function(e,n){if(!e)return"";var r=function(e){switch(e.arrayFormat){case"index":return function(n,r,o){return null===r?[t(n,e),"[",o,"]"].join(""):[t(n,e),"[",t(o,e),"]=",t(r,e)].join("")};case"bracket":return function(n,r){return null===r?[t(n,e),"[]"].join(""):[t(n,e),"[]=",t(r,e)].join("")};default:return function(n,r){return null===r?t(n,e):[t(n,e),"=",t(r,e)].join("")}}}(n=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},n)),o=Object.keys(e);return!1!==n.sort&&o.sort(n.sort),o.map(function(o){var i=e[o];if(void 0===i)return"";if(null===i)return t(o,n);if(Array.isArray(i)){for(var s=[],a=0,u=i.slice();a<u.length;a+=1){var c=u[a];void 0!==c&&s.push(r(o,c,s.length))}return s.join("&")}return t(o,n)+"="+t(i,n)}).filter(function(e){return e.length>0}).join("&")}(n.query,{skipNulls:!0}),s=i?e+"?"+i:e;r&&(r=JSON.stringify(r)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var a=global&&global.fetch||window&&window.fetch;return Promise.resolve(a(s,Object.assign({},n,{body:r,headers:o}))).then(function(e){function n(){if(!e.ok)throw Object.assign({},t.body,{status:e.status});return e.headers.forEach(function(e,n){return t.headers[n]=e}),t}if("No Content"===e.statusText)return{};var t={headers:{}},r=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){t.body=e}):Promise.resolve(e.text()).then(function(e){t.body={message:e}});return r&&r.then?r.then(n):n()})}catch(e){return Promise.reject(e)}}
import e from"node-fetch";import"decode-uri-component";var n=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})};function t(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}global.fetch||(global.fetch=e,global.Response=e.Response,global.Headers=e.Headers,global.Request=e.Request);export default function(e,n){void 0===n&&(n={});try{var r=n.body,o=n.headers;void 0===o&&(o={});var i=function(e,n){if(!e)return"";var r=function(e){switch(e.arrayFormat){case"index":return function(n,r,o){return null===r?[t(n,e),"[",o,"]"].join(""):[t(n,e),"[",t(o,e),"]=",t(r,e)].join("")};case"bracket":return function(n,r){return null===r?[t(n,e),"[]"].join(""):[t(n,e),"[]=",t(r,e)].join("")};default:return function(n,r){return null===r?t(n,e):[t(n,e),"=",t(r,e)].join("")}}}(n=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},n)),o=Object.keys(e);return!1!==n.sort&&o.sort(n.sort),o.map(function(o){var i=e[o];if(void 0===i)return"";if(null===i)return t(o,n);if(Array.isArray(i)){for(var s=[],a=0,u=i.slice();a<u.length;a+=1){var c=u[a];void 0!==c&&s.push(r(o,c,s.length))}return s.join("&")}return t(o,n)+"="+t(i,n)}).filter(function(e){return e.length>0}).join("&")}(n.query,{skipNulls:!0}),s=i?e+"?"+i:e;r&&(r=JSON.stringify(r)),o=Object.assign({},{Accept:"application/json","Content-Type":"application/json"},o);var a=global&&global.fetch||window&&window.fetch;return Promise.resolve(a(s,Object.assign({},n,{body:r,headers:o}))).then(function(e){function n(){if(!e.ok)throw Object.assign({},t.body,{status:e.status});return e.headers.forEach(function(e,n){return t.headers[n]=e}),t}if("No Content"===e.statusText)return{};var t={headers:{}},r=function(e){return e.headers.get("content-type")&&e.headers.get("content-type").includes("application/json")}(e)?Promise.resolve(e.json()).then(function(e){t.body=e}):Promise.resolve(e.text()).then(function(e){t.body={message:e}});return r&&r.then?r.then(n):n()})}catch(e){return Promise.reject(e)}}
//# sourceMappingURL=index.m.js.map
{
"name": "@36node/fetch",
"version": "0.6.4",
"version": "0.6.5",
"description": "Fetch tool.",

@@ -38,3 +38,3 @@ "repository": {

},
"gitHead": "ebb7ffc9bb965148d40c4b666eebe0247b54c41c"
"gitHead": "6692cf1faa66681533af8ef447624bc430778af0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc