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

gangway

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gangway - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

2

gangway.build.js

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

module.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=n(3),o=n(5);t.exports=function(t,e){if(!t)throw new TypeError("Please provide a configuration object as the first argument.");if("baseURL"in t==!1)throw new TypeError("baseURL configuration option is required");var n={config:t,ajax:r,toString:function(){return t.baseURL},route:function(t){return o(n,t)}};return n.route(e)}},function(t,e,n){"use strict";function r(){}function o(t){try{return t.then}catch(e){return v=e,m}}function i(t,e){try{return t(e)}catch(n){return v=n,m}}function s(t,e,n){try{t(e,n)}catch(r){return v=r,m}}function u(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._67=0,this._7=null,this._20=[],t!==r&&d(t,this)}function a(t,e,n){return new t.constructor(function(o,i){var s=new u(r);s.then(o,i),c(t,new l(e,n,s))})}function c(t,e){for(;3===t._67;)t=t._7;return 0===t._67?void t._20.push(e):void y(function(){var n=1===t._67?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._67?h(e.promise,t._7):f(e.promise,t._7));var r=i(n,t._7);r===m?f(e.promise,v):h(e.promise,r)})}function h(t,e){if(e===t)return f(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"==typeof e||"function"==typeof e)){var n=o(e);if(n===m)return f(t,v);if(n===t.then&&e instanceof u)return t._67=3,t._7=e,void p(t);if("function"==typeof n)return void d(n.bind(e),t)}t._67=1,t._7=e,p(t)}function f(t,e){t._67=2,t._7=e,p(t)}function p(t){for(var e=0;e<t._20.length;e++)c(t,t._20[e]);t._20=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function d(t,e){var n=!1,r=s(t,function(t){n||(n=!0,h(e,t))},function(t){n||(n=!0,f(e,t))});n||r!==m||(n=!0,f(e,v))}var y=n(2),v=null,m={};t.exports=u,u._83=r,u.prototype.then=function(t,e){if(this.constructor!==u)return a(this,t,e);var n=new u(r);return c(this,new l(t,e,n)),n}},function(t,e){(function(e){"use strict";function n(t){u.length||(s(),a=!0),u[u.length]=t}function r(){for(;c<u.length;){var t=c;if(c+=1,u[t].call(),c>h){for(var e=0,n=u.length-c;n>e;e++)u[e]=u[e+c];u.length-=c,c=0}}u.length=0,c=0,a=!1}function o(t){var e=1,n=new f(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}function i(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}t.exports=n;var s,u=[],a=!1,c=0,h=1024,f=e.MutationObserver||e.WebKitMutationObserver;s="function"==typeof f?o(r):i(r),n.requestFlush=s,n.makeRequestCallFromTimer=i}).call(e,function(){return this}())},function(t,e,n){"use strict";var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(8),i=n(15),s=n(7),u={params:{},headers:{},method:"GET",path:"",type:"application/json",onResponse:function(t){return t}};t.exports=function(t,e){var n=r({},u,t,e);if("mock"in n)return o.resolve(n.mock);var a=i(n.method,s(n.baseURL,n.path,n.params));return a.send(n.params).query(n.query).set(n.headers).type(n.type),new o(function(t,e){a.end(function(n,r){return n?e(n):t(r.body)})}).then(n.onResponse)}},function(t,e){"use strict";t.exports=function(t,e){var n=void 0===arguments[2]?{}:arguments[2];for(var r in t)n[r]=e(t[r],r,t);return n}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t){var e=void 0===arguments[1]?{}:arguments[1];return r(e,function(e){return r(e,function(e){return t.ajax.bind(null,t.config)})},t)}},function(t,e){"use strict";t.exports=function(t){var e=void 0===arguments[1]?{}:arguments[1];return t.replace(/\{(.+?)\}/,function(t,n){if(n=n.trim(),n in e==!1)throw TypeError("Parameter "+n+" was not provided in body option");return e[n]})}},function(t,e,n){"use strict";var r=n(6);t.exports=function(t,e,n){return t=t.replace(/\/$/,""),e=e.replace(/^\//,""),r(t+"/"+e,n)}},function(t,e,n){"use strict";t.exports=n(12)},function(t,e,n){"use strict";var r=n(1);t.exports=r,r.prototype.done=function(t,e){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(t){setTimeout(function(){throw t},0)})}},function(t,e,n){"use strict";function r(t){var e=new o(o._83);return e._67=1,e._7=t,e}var o=n(1);n(2);t.exports=o;var i=r(!0),s=r(!1),u=r(null),a=r(void 0),c=r(0),h=r("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return u;if(void 0===t)return a;if(t===!0)return i;if(t===!1)return s;if(0===t)return c;if(""===t)return h;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new o(e.bind(t))}catch(n){return new o(function(t,e){e(n)})}return r(t)},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,n){function r(s,u){if(u&&("object"==typeof u||"function"==typeof u)){if(u instanceof o&&u.then===o.prototype.then){for(;3===u._67;)u=u._7;return 1===u._67?r(s,u._7):(2===u._67&&n(u._7),void u.then(function(t){r(s,t)},n))}var a=u.then;if("function"==typeof a){var c=new o(a.bind(u));return void c.then(function(t){r(s,t)},n)}}e[s]=u,0===--i&&t(e)}if(0===e.length)return t([]);for(var i=e.length,s=0;s<e.length;s++)r(s,e[s])})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){t.forEach(function(t){o.resolve(t).then(e,n)})})},o.prototype["catch"]=function(t){return this.then(null,t)}},function(t,e,n){"use strict";var r=n(1);t.exports=r,r.prototype["finally"]=function(t){return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})}},function(t,e,n){"use strict";t.exports=n(1),n(9),n(11),n(10),n(13)},function(t,e,n){"use strict";var r=n(1),o=n(14);t.exports=r,r.denodeify=function(t,e){return e=e||1/0,function(){var n=this,o=Array.prototype.slice.call(arguments);return new r(function(r,i){for(;o.length&&o.length>e;)o.pop();o.push(function(t,e){t?i(t):r(e)});var s=t.apply(n,o);!s||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof s.then||r(s)})}},r.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),n="function"==typeof e[e.length-1]?e.pop():null,i=this;try{return t.apply(this,arguments).nodeify(n,i)}catch(s){if(null===n||"undefined"==typeof n)return new r(function(t,e){e(s)});o(function(){n.call(i,s)})}}},r.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(n){o(function(){t.call(e,null,n)})},function(n){o(function(){t.call(e,n)})})}},function(t,e,n){"use strict";function r(){if(a.length)throw a.shift()}function o(t){var e;e=u.length?u.pop():new i,e.task=t,s(e)}function i(){this.task=null}var s=n(2),u=[],a=[],c=s.makeRequestCallFromTimer(r);t.exports=o,i.prototype.call=function(){try{this.task.call()}catch(t){o.onerror?o.onerror(t):(a.push(t),c())}finally{this.task=null,u[u.length]=this}}},function(t,e,n){function r(){}function o(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function u(t){for(var e,n,r={},o=t.split("&"),i=0,s=o.length;s>i;++i)n=o[i],e=n.split("="),r[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return r}function a(t){var e,n,r,o,i=t.split(/\r?\n/),s={};i.pop();for(var u=0,a=i.length;a>u;++u)n=i[u],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),o=m(n.slice(e+1)),s[r]=o;return s}function c(t){return t.split(/ *; */).shift()}function h(t){return y(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function f(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function p(t,e){var n=this;d.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new f(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,n.callback(t)}if(n.emit("response",e),t)return n.callback(t,e);if(e.status>=200&&e.status<300)return n.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,n.callback(t||o,e)})}function l(t,e){return"function"==typeof e?new p("GET",t).end(e):1==arguments.length?new p("GET",t):new p(t,e)}var d=n(16),y=n(17),v="undefined"==typeof window?this||self:window;l.getXHR=function(){if(!(!v.XMLHttpRequest||v.location&&"file:"==v.location.protocol&&v.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1};var m="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};l.serializeObject=s,l.parseString=u,l.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},l.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},l.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},f.prototype.get=function(t){return this.header[t.toLowerCase()]},f.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=h(e);for(var r in n)this[r]=n[r]},f.prototype.parseBody=function(t){var e=l.parse[this.type];return e&&t&&(t.length||t instanceof Object)?e(t):null},f.prototype.setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},f.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},l.Response=f,d(p.prototype),p.prototype.use=function(t){return t(this),this},p.prototype.timeout=function(t){return this._timeout=t,this},p.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},p.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},p.prototype.set=function(t,e){if(i(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},p.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},p.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},p.prototype.type=function(t){return this.set("Content-Type",l.types[t]||t),this},p.prototype.accept=function(t){return this.set("Accept",l.types[t]||t),this},p.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},p.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},p.prototype.field=function(t,e){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e),this},p.prototype.attach=function(t,e,n){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e,n),this},p.prototype.send=function(t){var e=i(t),n=this.getHeader("Content-Type");if(e&&i(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||o(t)?this:(n||this.type("json"),this)},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},p.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype.withCredentials=function(){return this._withCredentials=!0,this},p.prototype.end=function(t){var e=this,n=this.xhr=l.getXHR(),i=this._query.join("&"),s=this._timeout,u=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(r){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.emit("progress",t)};this.hasListeners("progress")&&(n.onprogress=a);try{n.upload&&this.hasListeners("progress")&&(n.upload.onprogress=a)}catch(c){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=l.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!o(u)){var h=l.serialize[this.getHeader("Content-Type")];h&&(u=h(u))}for(var f in this.header)null!=this.header[f]&&n.setRequestHeader(f,this.header[f]);return this.emit("request",this),n.send(u),this},l.Request=p,l.get=function(t,e,n){var r=l("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},l.head=function(t,e,n){var r=l("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.del=function(t,e){var n=l("DELETE",t);return e&&n.end(e),n},l.patch=function(t,e,n){var r=l("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.post=function(t,e,n){var r=l("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.put=function(t,e,n){var r=l("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},t.exports=l},function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n){n=n.slice(0);for(var r=0,o=n.length;o>r;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){t.exports=function(t,e,n){for(var r=0,o=t.length,i=3==arguments.length?n:t[r++];o>r;)i=e.call(null,i,t[r],++r,t);return i}}]);
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=n(3),o=n(5);t.exports=function(t,e){if(!t)throw new TypeError("Please provide a configuration object as the first argument.");if("baseURL"in t==!1)throw new TypeError("baseURL configuration option is required");var n={config:t,ajax:r,toString:function(){return t.baseURL},route:function(t){return o(n,t)}};return n.route(e)}},function(t,e,n){"use strict";function r(){}function o(t){try{return t.then}catch(e){return v=e,m}}function i(t,e){try{return t(e)}catch(n){return v=n,m}}function s(t,e,n){try{t(e,n)}catch(r){return v=r,m}}function u(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._67=0,this._7=null,this._20=[],t!==r&&d(t,this)}function a(t,e,n){return new t.constructor(function(o,i){var s=new u(r);s.then(o,i),c(t,new l(e,n,s))})}function c(t,e){for(;3===t._67;)t=t._7;return 0===t._67?void t._20.push(e):void y(function(){var n=1===t._67?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._67?h(e.promise,t._7):f(e.promise,t._7));var r=i(n,t._7);r===m?f(e.promise,v):h(e.promise,r)})}function h(t,e){if(e===t)return f(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"==typeof e||"function"==typeof e)){var n=o(e);if(n===m)return f(t,v);if(n===t.then&&e instanceof u)return t._67=3,t._7=e,void p(t);if("function"==typeof n)return void d(n.bind(e),t)}t._67=1,t._7=e,p(t)}function f(t,e){t._67=2,t._7=e,p(t)}function p(t){for(var e=0;e<t._20.length;e++)c(t,t._20[e]);t._20=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function d(t,e){var n=!1,r=s(t,function(t){n||(n=!0,h(e,t))},function(t){n||(n=!0,f(e,t))});n||r!==m||(n=!0,f(e,v))}var y=n(2),v=null,m={};t.exports=u,u._83=r,u.prototype.then=function(t,e){if(this.constructor!==u)return a(this,t,e);var n=new u(r);return c(this,new l(t,e,n)),n}},function(t,e){(function(e){"use strict";function n(t){u.length||(s(),a=!0),u[u.length]=t}function r(){for(;c<u.length;){var t=c;if(c+=1,u[t].call(),c>h){for(var e=0,n=u.length-c;n>e;e++)u[e]=u[e+c];u.length-=c,c=0}}u.length=0,c=0,a=!1}function o(t){var e=1,n=new f(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}function i(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}t.exports=n;var s,u=[],a=!1,c=0,h=1024,f=e.MutationObserver||e.WebKitMutationObserver;s="function"==typeof f?o(r):i(r),n.requestFlush=s,n.makeRequestCallFromTimer=i}).call(e,function(){return this}())},function(t,e,n){"use strict";var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(8),i=n(15),s=n(7),u={body:void 0,params:void 0,headers:{},method:"GET",path:"",type:"application/json",onResponse:function(t){return t}};t.exports=function(t,e){var n=r({},u,t,e);if("mock"in n)return o.resolve(n.mock);var a=s(n.baseURL,n.path,n.params||n.body),c=i(n.method,a);return c.send(n.params).query(n.query).set(n.headers).type(n.type),new o(function(t,e){c.end(function(n,r){return n?e(n):t(r.body)})}).then(n.onResponse)}},function(t,e){"use strict";t.exports=function(t,e){var n=void 0===arguments[2]?{}:arguments[2];for(var r in t)n[r]=e(t[r],r,t);return n}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t){var e=void 0===arguments[1]?{}:arguments[1];return r(e,function(e){return r(e,function(e){return t.ajax.bind(null,t.config)})},t)}},function(t,e){"use strict";t.exports=function(t){var e=void 0===arguments[1]?{}:arguments[1];return t.replace(/\{(.+?)\}/,function(t,n){if(n=n.trim(),n in e==!1)throw TypeError("Parameter "+n+" was not provided in body option");return e[n]})}},function(t,e,n){"use strict";var r=n(6);t.exports=function(t,e,n){return t=t.replace(/\/$/,""),e=e.replace(/^\//,""),r(t+"/"+e,n)}},function(t,e,n){"use strict";t.exports=n(12)},function(t,e,n){"use strict";var r=n(1);t.exports=r,r.prototype.done=function(t,e){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(t){setTimeout(function(){throw t},0)})}},function(t,e,n){"use strict";function r(t){var e=new o(o._83);return e._67=1,e._7=t,e}var o=n(1);n(2);t.exports=o;var i=r(!0),s=r(!1),u=r(null),a=r(void 0),c=r(0),h=r("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return u;if(void 0===t)return a;if(t===!0)return i;if(t===!1)return s;if(0===t)return c;if(""===t)return h;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new o(e.bind(t))}catch(n){return new o(function(t,e){e(n)})}return r(t)},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,n){function r(s,u){if(u&&("object"==typeof u||"function"==typeof u)){if(u instanceof o&&u.then===o.prototype.then){for(;3===u._67;)u=u._7;return 1===u._67?r(s,u._7):(2===u._67&&n(u._7),void u.then(function(t){r(s,t)},n))}var a=u.then;if("function"==typeof a){var c=new o(a.bind(u));return void c.then(function(t){r(s,t)},n)}}e[s]=u,0===--i&&t(e)}if(0===e.length)return t([]);for(var i=e.length,s=0;s<e.length;s++)r(s,e[s])})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){t.forEach(function(t){o.resolve(t).then(e,n)})})},o.prototype["catch"]=function(t){return this.then(null,t)}},function(t,e,n){"use strict";var r=n(1);t.exports=r,r.prototype["finally"]=function(t){return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})}},function(t,e,n){"use strict";t.exports=n(1),n(9),n(11),n(10),n(13)},function(t,e,n){"use strict";var r=n(1),o=n(14);t.exports=r,r.denodeify=function(t,e){return e=e||1/0,function(){var n=this,o=Array.prototype.slice.call(arguments);return new r(function(r,i){for(;o.length&&o.length>e;)o.pop();o.push(function(t,e){t?i(t):r(e)});var s=t.apply(n,o);!s||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof s.then||r(s)})}},r.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),n="function"==typeof e[e.length-1]?e.pop():null,i=this;try{return t.apply(this,arguments).nodeify(n,i)}catch(s){if(null===n||"undefined"==typeof n)return new r(function(t,e){e(s)});o(function(){n.call(i,s)})}}},r.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(n){o(function(){t.call(e,null,n)})},function(n){o(function(){t.call(e,n)})})}},function(t,e,n){"use strict";function r(){if(a.length)throw a.shift()}function o(t){var e;e=u.length?u.pop():new i,e.task=t,s(e)}function i(){this.task=null}var s=n(2),u=[],a=[],c=s.makeRequestCallFromTimer(r);t.exports=o,i.prototype.call=function(){try{this.task.call()}catch(t){o.onerror?o.onerror(t):(a.push(t),c())}finally{this.task=null,u[u.length]=this}}},function(t,e,n){function r(){}function o(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function u(t){for(var e,n,r={},o=t.split("&"),i=0,s=o.length;s>i;++i)n=o[i],e=n.split("="),r[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return r}function a(t){var e,n,r,o,i=t.split(/\r?\n/),s={};i.pop();for(var u=0,a=i.length;a>u;++u)n=i[u],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),o=m(n.slice(e+1)),s[r]=o;return s}function c(t){return t.split(/ *; */).shift()}function h(t){return y(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function f(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function p(t,e){var n=this;d.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new f(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,n.callback(t)}if(n.emit("response",e),t)return n.callback(t,e);if(e.status>=200&&e.status<300)return n.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,n.callback(t||o,e)})}function l(t,e){return"function"==typeof e?new p("GET",t).end(e):1==arguments.length?new p("GET",t):new p(t,e)}var d=n(16),y=n(17),v="undefined"==typeof window?this||self:window;l.getXHR=function(){if(!(!v.XMLHttpRequest||v.location&&"file:"==v.location.protocol&&v.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1};var m="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};l.serializeObject=s,l.parseString=u,l.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},l.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},l.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},f.prototype.get=function(t){return this.header[t.toLowerCase()]},f.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=h(e);for(var r in n)this[r]=n[r]},f.prototype.parseBody=function(t){var e=l.parse[this.type];return e&&t&&(t.length||t instanceof Object)?e(t):null},f.prototype.setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},f.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},l.Response=f,d(p.prototype),p.prototype.use=function(t){return t(this),this},p.prototype.timeout=function(t){return this._timeout=t,this},p.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},p.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},p.prototype.set=function(t,e){if(i(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},p.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},p.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},p.prototype.type=function(t){return this.set("Content-Type",l.types[t]||t),this},p.prototype.accept=function(t){return this.set("Accept",l.types[t]||t),this},p.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},p.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},p.prototype.field=function(t,e){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e),this},p.prototype.attach=function(t,e,n){return this._formData||(this._formData=new v.FormData),this._formData.append(t,e,n),this},p.prototype.send=function(t){var e=i(t),n=this.getHeader("Content-Type");if(e&&i(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||o(t)?this:(n||this.type("json"),this)},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},p.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype.withCredentials=function(){return this._withCredentials=!0,this},p.prototype.end=function(t){var e=this,n=this.xhr=l.getXHR(),i=this._query.join("&"),s=this._timeout,u=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(r){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.emit("progress",t)};this.hasListeners("progress")&&(n.onprogress=a);try{n.upload&&this.hasListeners("progress")&&(n.upload.onprogress=a)}catch(c){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=l.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!o(u)){var h=l.serialize[this.getHeader("Content-Type")];h&&(u=h(u))}for(var f in this.header)null!=this.header[f]&&n.setRequestHeader(f,this.header[f]);return this.emit("request",this),n.send(u),this},l.Request=p,l.get=function(t,e,n){var r=l("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},l.head=function(t,e,n){var r=l("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.del=function(t,e){var n=l("DELETE",t);return e&&n.end(e),n},l.patch=function(t,e,n){var r=l("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.post=function(t,e,n){var r=l("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},l.put=function(t,e,n){var r=l("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},t.exports=l},function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n){n=n.slice(0);for(var r=0,o=n.length;o>r;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){t.exports=function(t,e,n){for(var r=0,o=t.length,i=3==arguments.length?n:t[r++];o>r;)i=e.call(null,i,t[r],++r,t);return i}}]);
//# sourceMappingURL=gangway.build.js.map
{
"name": "gangway",
"version": "0.3.0",
"version": "0.4.0",
"description": "A client-side API abstraction layer",

@@ -5,0 +5,0 @@ "main": "src/api.js",

@@ -49,5 +49,14 @@ # gangway

Where does documentation exist? Is there anything important about it
the reader should know?
### Available options
```
baseURL : The base URL prepended to all requests
body : The request body
method : Request method (GET, POST, PUT, PATCH, DELETE, etc...)
onResponse : Run before resolving a request for preprocessing data
params : Populate bindings in paths and are sent as request bodies. Defaults to body.
path : The path fragment of the endpoint, appended to baseURL
type : Content type, defaults to JSON
```
## Final words

@@ -54,0 +63,0 @@

@@ -10,3 +10,4 @@ 'use strict';

var defaults = {
params: {},
body: undefined,
params: undefined,
headers: {},

@@ -28,3 +29,4 @@ method: 'GET',

var message = Request(options.method, url(options.baseURL, options.path, options.params));
var location = url(options.baseURL, options.path, options.params || options.body);
var message = Request(options.method, location);

@@ -31,0 +33,0 @@ message.send(options.params) // body parameters

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