http-client
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -30,3 +30,3 @@ 'use strict'; | ||
*/ | ||
var createStack = function createStack() { | ||
var createStack = exports.createStack = function createStack() { | ||
for (var _len = arguments.length, middleware = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -47,13 +47,5 @@ middleware[_key] = arguments[_key]; | ||
// TODO: BEWARE-CRAZY DRAGONS BE LURKING HERE. If we use `export const createStack` | ||
// above (like we do everywhere else in this file) for some reason the `middleware` | ||
// is an array of the arguments passed to webpack's module closure, not those that | ||
// were passed to createStack. When we use this export down below instead, we get | ||
// the behavior we expect! Not sure yet if this is a babel or webpack bug... | ||
exports.createStack = createStack; | ||
/** | ||
* Creates a fetch function using all arguments as middleware. | ||
*/ | ||
var createFetch = exports.createFetch = function createFetch() { | ||
@@ -60,0 +52,0 @@ if (arguments.length === 0) return fetch; |
{ | ||
"name": "http-client", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Compose HTTP clients using JavaScript's fetch API", | ||
@@ -5,0 +5,0 @@ "author": "Michael Jackson", |
@@ -86,3 +86,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
var createStack = function createStack() { | ||
var createStack = exports.createStack = function createStack() { | ||
for (var _len = arguments.length, middleware = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -103,13 +103,5 @@ middleware[_key] = arguments[_key]; | ||
// TODO: BEWARE-CRAZY DRAGONS BE LURKING HERE. If we use `export const createStack` | ||
// above (like we do everywhere else in this file) for some reason the `middleware` | ||
// is an array of the arguments passed to webpack's module closure, not those that | ||
// were passed to createStack. When we use this export down below instead, we get | ||
// the behavior we expect! Not sure yet if this is a babel or webpack bug... | ||
exports.createStack = createStack; | ||
/** | ||
* Creates a fetch function using all arguments as middleware. | ||
*/ | ||
var createFetch = exports.createFetch = function createFetch() { | ||
@@ -116,0 +108,0 @@ if (arguments.length === 0) return fetch; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.HTTPClient=n():t.HTTPClient=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.requestInfo=n.parseJSON=n.parseText=n.params=n.json=n.body=n.query=n.base=n.accept=n.auth=n.header=n.method=n.createFetch=n.createStack=void 0;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o=r(1),u=void 0;"function"==typeof fetch?u=fetch:"object"!==e(window)&&(u=r(!function(){var t=new Error('Cannot find module "node-fetch"');throw t.code="MODULE_NOT_FOUND",t}()));var i=function(t){return"string"==typeof t?t:(0,o.stringify)(t)},c=function(t,n,r){return t(n,r)},f=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return 0===n.length?c:n.reduceRight(function(t,n){return function(r,e,o){return n(function(n,e){return t(r,n,e)},e,o)}})};n.createStack=f;var a=(n.createFetch=function(){if(0===arguments.length)return fetch;var t=f.apply(void 0,arguments);return function(n,r){return t(u,n,r)}},function(t,n,r){return(t.headers||(t.headers={}))[n]=r}),s=(n.method=function(t){return function(n,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return e.method=t,n(r,e)}},n.header=function(t,n){return function(r,e){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return a(o,t,n),r(e,o)}}),p=(n.auth=function(t){return s("Authorization",t)},n.accept=function(t){return s("Accept",t)},n.base=function(t){return function(n,r,e){return n(t+r,e)}},n.query=function(t){var n=i(t);return function(t,r,e){return r+=(-1===r.indexOf("?")?"?":"&")+n,t(r,e)}}),d=n.body=function(t,n){return function(r,e){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=t,null!=t.length&&a(o,"Content-Length",t.length),n&&a(o,"Content-Type",n),r(e,o)}},l=(n.json=function(t){return d("string"==typeof t?t:JSON.stringify(t),"application/json")},n.params=function(t){var n=i(t);return function(t,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(e.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?p(n):d(n,"application/x-www-form-urlencoded");return u(t,r,e)}},function(t){return function(n,r,e){return n(r,e).then(t)}});n.parseText=function(){var t=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return l(function(n){return n.text().then(function(r){return n[t]=r,n})})},n.parseJSON=function(){var t=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return l(function(n){return n.json().then(function(r){return n[t]=r,n},function(t){throw new Error("Error parsing JSON: "+t.stack)})})},n.requestInfo=function(){return function(t,n,r){return t(n,r).then(function(t){return t.requestURL=n,t.requestOptions=r,t},function(t){throw t=t||new Error,t.requestURL=n,t.requestOptions=r,t})}}},function(t,n,r){"use strict";var e=r(2);n.extract=function(t){return t.split("?")[1]||""},n.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,n){var r=n.replace(/\+/g," ").split("="),e=r.shift(),o=r.length>0?r.join("="):void 0;return e=decodeURIComponent(e),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(e)?Array.isArray(t[e])?t[e].push(o):t[e]=[t[e],o]:t[e]=o,t},{}):{})},n.stringify=function(t){return t?Object.keys(t).sort().map(function(n){var r=t[n];return void 0===r?"":null===r?n:Array.isArray(r)?r.slice().sort().map(function(t){return e(n)+"="+e(t)}).join("&"):e(n)+"="+e(r)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,n){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}}])}); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.HTTPClient=n():t.HTTPClient=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.requestInfo=n.parseJSON=n.parseText=n.params=n.json=n.body=n.query=n.base=n.accept=n.auth=n.header=n.method=n.createFetch=n.createStack=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o=e(1),u=void 0;"function"==typeof fetch?u=fetch:"object"!==r(window)&&(u=e(!function(){var t=new Error('Cannot find module "node-fetch"');throw t.code="MODULE_NOT_FOUND",t}()));var i=function(t){return"string"==typeof t?t:(0,o.stringify)(t)},c=function(t,n,e){return t(n,e)},f=n.createStack=function(){for(var t=arguments.length,n=Array(t),e=0;t>e;e++)n[e]=arguments[e];return 0===n.length?c:n.reduceRight(function(t,n){return function(e,r,o){return n(function(n,r){return t(e,n,r)},r,o)}})},a=(n.createFetch=function(){if(0===arguments.length)return fetch;var t=f.apply(void 0,arguments);return function(n,e){return t(u,n,e)}},function(t,n,e){return(t.headers||(t.headers={}))[n]=e}),s=(n.method=function(t){return function(n,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r.method=t,n(e,r)}},n.header=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return a(o,t,n),e(r,o)}}),p=(n.auth=function(t){return s("Authorization",t)},n.accept=function(t){return s("Accept",t)},n.base=function(t){return function(n,e,r){return n(t+e,r)}},n.query=function(t){var n=i(t);return function(t,e,r){return e+=(-1===e.indexOf("?")?"?":"&")+n,t(e,r)}}),d=n.body=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=t,null!=t.length&&a(o,"Content-Length",t.length),n&&a(o,"Content-Type",n),e(r,o)}},l=(n.json=function(t){return d("string"==typeof t?t:JSON.stringify(t),"application/json")},n.params=function(t){var n=i(t);return function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?p(n):d(n,"application/x-www-form-urlencoded");return u(t,e,r)}},function(t){return function(n,e,r){return n(e,r).then(t)}});n.parseText=function(){var t=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return l(function(n){return n.text().then(function(e){return n[t]=e,n})})},n.parseJSON=function(){var t=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return l(function(n){return n.json().then(function(e){return n[t]=e,n},function(t){throw new Error("Error parsing JSON: "+t.stack)})})},n.requestInfo=function(){return function(t,n,e){return t(n,e).then(function(t){return t.requestURL=n,t.requestOptions=e,t},function(t){throw t=t||new Error,t.requestURL=n,t.requestOptions=e,t})}}},function(t,n,e){"use strict";var r=e(2);n.extract=function(t){return t.split("?")[1]||""},n.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,n){var e=n.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(r)?Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]:t[r]=o,t},{}):{})},n.stringify=function(t){return t?Object.keys(t).sort().map(function(n){var e=t[n];return void 0===e?"":null===e?n:Array.isArray(e)?e.slice().sort().map(function(t){return r(n)+"="+r(t)}).join("&"):r(n)+"="+r(e)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,n){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}}])}); |
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
28618
466