Comparing version 1.1.4 to 1.1.5
{ | ||
"name": "uhttp", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"main": "src/uhttp.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -1,2 +0,2 @@ | ||
/*! uhttp v1.1.2 | (c) 2015 @flux159 | http://flux159.github.io/uhttp/ */ | ||
!function(a,b){"function"==typeof define&&define.amd?define(b):a.uhttp=b(a)}(this,function(){"use strict";function a(a,b){this.name=a,this.data={},b||(b={}),this.timeout=b.timeout||0}function b(a){return null!==a&&"object"==typeof a}function c(a){return null!==a&&"string"==typeof a}function d(a){return"[object File]"===y.call(a)}function e(a){return"[object Blob]"===y.call(a)}function f(a){return"[object FormData]"===y.call(a)}function g(a){return a}function h(a){return a}function i(a){return!b(a)||d(a)||e(a)||f(a)?a:JSON.stringify(a)}function j(a){var b,c=a.responseText;try{b=JSON.parse(c)}catch(d){b=c}return b}function k(a){var b=a,c=document.documentMode;return c&&(z.setAttribute("href",b),b=z.href),z.setAttribute("href",b),{href:z.href,protocol:z.protocol?z.protocol.replace(/:$/,""):"",host:z.host,search:z.search?z.search.replace(/^\?/,""):"",hash:z.hash?z.hash.replace(/^#/,""):"",hostname:z.hostname,port:z.port,pathname:"/"===z.pathname.charAt(0)?z.pathname:"/"+z.pathname}}function l(a){var b=c(a)?k(a):a;return b.protocol===A.protocol&&b.host===A.host}function m(a){if(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.substring(1);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return""}return document.cookie}function n(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="expires="+d.toUTCString();document.cookie=a+"="+b+"; "+e}else document.cookie=a+"="+b+"; "}function o(a){document.cookie=a+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function p(a){C=a,C.headers&&b(C.headers)||(C.headers={})}function q(){return C}function r(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function s(a,b){for(var c in b)b.hasOwnProperty(c)&&a.setRequestHeader(c,b[c])}function t(a){var b={then:function(){},"catch":function(){},"finally":function(){}},c={then:function(a){return b.then=a,c},"catch":function(a){return b["catch"]=a,c},"finally":function(a){return b["finally"]=a,a}},d="uhttp_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),e=document.createElement("script");return v[d]=function(a){e.parentNode.removeChild(e),v[d]=void 0,e=null,d=null,b.then.call(b,a),b["finally"].call(b,a),b=null},e.onerror=function(a){e.parentNode.removeChild(e),v[d]=void 0,e=null,d=null,b["catch"].call(b,a),b["finally"].call(b,a),b=null},e.src=a.replace("JSON_CALLBACK",d),document.body.appendChild(e),c}function u(a,c,g,h){g||(g={});var i={then:function(){},"catch":function(){},"finally":function(){}},j={then:function(a){return i.then=a,j},"catch":function(a){return i["catch"]=a,j},"finally":function(a){return i["finally"]=a,a}},k={};if(r(k,{Accept:"application/json, text/plain, */*"}),("POST"===a||"PUT"===a||"PATCH"===a)&&(!b(h)||d(h)||e(h)||f(h)||r(k,{"Content-Type":D})),r(k,C.headers),b(g.headers)&&r(k,g.headers),l(c)){var n={},o=m(g.xsrfCookieName||C.xsrfCookieName||B.xsrfCookieName);o&&(n[g.xsrfHeaderName||C.xsrfHeaderName||B.xsrfHeaderName]=o,r(k,n))}var p={timeout:g.timeout||C.timeout,cache:g.cache||C.cache,withCredentials:g.withCredentials||C.withCredentials,progressHandler:g.progressHandler||C.progressHandler,transformRequest:g.transformRequest||C.transformRequest||B.transformRequest,transformResponse:g.transformResponse||C.transformResponse||B.transformResponse,transformRequestData:g.transformRequestData||C.transformRequestData||B.transformRequestData,transformResponseData:g.transformResponseData||C.transformResponseData||B.transformResponseData},q={headers:k,options:p,type:a,url:c};p.transformRequest(q);var t=q.options.cache;if("GET"===q.type&&t){var u;if(u="boolean"==typeof t?x.get("__default").get(c):"Cache"===t.constructor.name?t.get(c):t.cache.get(c))return setTimeout(function(){i.then.call(i,u)},1),j}var w=v.XMLHttpRequest||ActiveXObject,y=new w("MSXML2.XMLHTTP.3.0");return q.options.progressHandler&&y.upload&&(y.upload.onprogress=q.options.progressHandler),y.open(q.type,q.url,!0),s(y,q.headers),q.options.withCredentials&&(y.withCredentials=!0),y.onreadystatechange=function(){if(4===y.readyState){q.options.transformResponse(y);var b=q.options.transformResponseData(y);y.status>=200&&y.status<300||304===y.status?("GET"===a&&t&&("boolean"==typeof t?x.get("__default").set(c,b):"Cache"===t.constructor.name?t.set(c,b):t.cache.set(c,b,t.options)),i.then.call(i,b,y.status,y)):i["catch"].call(i,b,y.status,y),i["finally"].call(i,b,y.status,y),q=null,i=null,y=null,b=null}},y.send(q.options.transformRequestData(h)),q.options.timeout>0&&setTimeout(function(){y&&y.abort()},q.options.timeout),j}var v=window;a.prototype.remove=function(a){delete this.data[a]},a.prototype.clear=function(){this.data={}},a.prototype.set=function(a,b,c){if(this.data[a]=b,c||(c={}),(c.timeout||this.timeout)>0){var d=this;setTimeout(function(){d.remove(a)},c.timeout||this.timeout)}},a.prototype.get=function(a){return this.data[a]};var w=function(){function b(){var b={__default:new a("__default")};return{get:function(c,d){if(b[c])return b[c];var e=new a(c,d);return b[c]=e,e}}}var c=null;return{getFactory:function(){return c||(c=b()),c}}}(),x=w.getFactory(),y=Object.prototype.toString,z=document.createElement("a"),A=k(v.location.href),B={transformRequest:g,transformResponse:h,transformRequestData:i,transformResponseData:j,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},C={headers:{},timeout:0,withCredentials:!1},D="application/json;charset=utf-8",E={};return E.setGlobalOptions=p,E.getGlobalOptions=q,E.CacheFactory=x,E.getCookie=m,E.setCookie=n,E.deleteCookie=o,E.get=function(a,b){return u("GET",a,b)},E.head=function(a,b){return u("HEAD",a,b)},E.put=function(a,b,c){return c||(c=b,b=null),u("PUT",a,b,c)},E.patch=function(a,b,c){return c||(c=b,b=null),u("PATCH",a,b,c)},E.post=function(a,b,c){return c||(c=b,b=null),u("POST",a,b,c)},E["delete"]=function(a,b){return u("DELETE",a,b)},E.jsonp=function(a){return t(a)},E}); | ||
/*! uhttp v1.1.5 | (c) 2015 @flux159 | http://flux159.github.io/uhttp/ */ | ||
!function(a,b){"undefined"!=typeof module?module.exports=b():a.uhttp=b(a)}(this,function(){"use strict";function a(a,b){this.name=a,this.data={},b||(b={}),this.timeout=b.timeout||0}function b(a){return null!==a&&"object"==typeof a}function c(a){return null!==a&&"string"==typeof a}function d(a){return"[object File]"===y.call(a)}function e(a){return"[object Blob]"===y.call(a)}function f(a){return"[object FormData]"===y.call(a)}function g(a){return a}function h(a){return a}function i(a){return!b(a)||d(a)||e(a)||f(a)?a:JSON.stringify(a)}function j(a){var b,c=a.responseText;try{b=JSON.parse(c)}catch(d){b=c}return b}function k(a){var b=a,c=document.documentMode;return c&&(z.setAttribute("href",b),b=z.href),z.setAttribute("href",b),{href:z.href,protocol:z.protocol?z.protocol.replace(/:$/,""):"",host:z.host,search:z.search?z.search.replace(/^\?/,""):"",hash:z.hash?z.hash.replace(/^#/,""):"",hostname:z.hostname,port:z.port,pathname:"/"===z.pathname.charAt(0)?z.pathname:"/"+z.pathname}}function l(a){var b=c(a)?k(a):a;return b.protocol===A.protocol&&b.host===A.host}function m(a){if(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.substring(1);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return""}return document.cookie}function n(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="expires="+d.toUTCString();document.cookie=a+"="+b+"; "+e}else document.cookie=a+"="+b+"; "}function o(a){document.cookie=a+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function p(a){C=a,C.headers&&b(C.headers)||(C.headers={})}function q(){return C}function r(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function s(a,b){for(var c in b)b.hasOwnProperty(c)&&a.setRequestHeader(c,b[c])}function t(a){var b={then:function(){},"catch":function(){},"finally":function(){}},c={then:function(a){return b.then=a,c},"catch":function(a){return b["catch"]=a,c},"finally":function(a){return b["finally"]=a,a}},d="uhttp_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),e=document.createElement("script");return v[d]=function(a){e.parentNode.removeChild(e),v[d]=void 0,e=null,d=null,b.then.call(b,a),b["finally"].call(b,a),b=null},e.onerror=function(a){e.parentNode.removeChild(e),v[d]=void 0,e=null,d=null,b["catch"].call(b,a),b["finally"].call(b,a),b=null},e.src=a.replace("JSON_CALLBACK",d),document.body.appendChild(e),c}function u(a,c,g,h){g||(g={});var i={then:function(){},"catch":function(){},"finally":function(){}},j={then:function(a){return i.then=a,j},"catch":function(a){return i["catch"]=a,j},"finally":function(a){return i["finally"]=a,a}},k={};if(r(k,{Accept:"application/json, text/plain, */*"}),("POST"===a||"PUT"===a||"PATCH"===a)&&(!b(h)||d(h)||e(h)||f(h)||r(k,{"Content-Type":D})),r(k,C.headers),b(g.headers)&&r(k,g.headers),l(c)){var n={},o=m(g.xsrfCookieName||C.xsrfCookieName||B.xsrfCookieName);o&&(n[g.xsrfHeaderName||C.xsrfHeaderName||B.xsrfHeaderName]=o,r(k,n))}var p={timeout:g.timeout||C.timeout,cache:g.cache||C.cache,withCredentials:g.withCredentials||C.withCredentials,progressHandler:g.progressHandler||C.progressHandler,transformRequest:g.transformRequest||C.transformRequest||B.transformRequest,transformResponse:g.transformResponse||C.transformResponse||B.transformResponse,transformRequestData:g.transformRequestData||C.transformRequestData||B.transformRequestData,transformResponseData:g.transformResponseData||C.transformResponseData||B.transformResponseData},q={headers:k,options:p,type:a,url:c};p.transformRequest(q);var t=q.options.cache;if("GET"===q.type&&t){var u;if(u="boolean"==typeof t?x.get("__default").get(c):"Cache"===t.constructor.name?t.get(c):t.cache.get(c))return setTimeout(function(){i.then.call(i,u)},1),j}var w=v.XMLHttpRequest||ActiveXObject,y=new w("MSXML2.XMLHTTP.3.0");return q.options.progressHandler&&y.upload&&(y.upload.onprogress=q.options.progressHandler),y.open(q.type,q.url,!0),s(y,q.headers),q.options.withCredentials&&(y.withCredentials=!0),y.onreadystatechange=function(){if(4===y.readyState){q.options.transformResponse(y);var b=q.options.transformResponseData(y);y.status>=200&&y.status<300||304===y.status?("GET"===a&&t&&("boolean"==typeof t?x.get("__default").set(c,b):"Cache"===t.constructor.name?t.set(c,b):t.cache.set(c,b,t.options)),i.then.call(i,b,y.status,y)):i["catch"].call(i,b,y.status,y),i["finally"].call(i,b,y.status,y),q=null,i=null,y=null,b=null}},y.send(q.options.transformRequestData(h)),q.options.timeout>0&&setTimeout(function(){y&&y.abort()},q.options.timeout),j}var v=window;a.prototype.remove=function(a){delete this.data[a]},a.prototype.clear=function(){this.data={}},a.prototype.set=function(a,b,c){if(this.data[a]=b,c||(c={}),(c.timeout||this.timeout)>0){var d=this;setTimeout(function(){d.remove(a)},c.timeout||this.timeout)}},a.prototype.get=function(a){return this.data[a]};var w=function(){function b(){var b={__default:new a("__default")};return{get:function(c,d){if(b[c])return b[c];var e=new a(c,d);return b[c]=e,e}}}var c=null;return{getFactory:function(){return c||(c=b()),c}}}(),x=w.getFactory(),y=Object.prototype.toString,z=document.createElement("a"),A=k(v.location.href),B={transformRequest:g,transformResponse:h,transformRequestData:i,transformResponseData:j,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},C={headers:{},timeout:0,withCredentials:!1},D="application/json;charset=utf-8",E={};return E.setGlobalOptions=p,E.getGlobalOptions=q,E.CacheFactory=x,E.getCookie=m,E.setCookie=n,E.deleteCookie=o,E.get=function(a,b){return u("GET",a,b)},E.head=function(a,b){return u("HEAD",a,b)},E.put=function(a,b,c){return c||(c=b,b=null),u("PUT",a,b,c)},E.patch=function(a,b,c){return c||(c=b,b=null),u("PATCH",a,b,c)},E.post=function(a,b,c){return c||(c=b,b=null),u("POST",a,b,c)},E["delete"]=function(a,b){return u("DELETE",a,b)},E.jsonp=function(a){return t(a)},E}); |
{ | ||
"name": "uhttp", | ||
"description": "A micro ajax http library with a unified api for browsers and nodejs", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"repository": "https://github.com/Flux159/uhttp", | ||
@@ -6,0 +6,0 @@ "homepage": "http://flux159.github.io/uhttp/", |
@@ -5,5 +5,3 @@ /** | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(factory); | ||
} else if (typeof module !== 'undefined') { | ||
if (typeof module !== 'undefined') { | ||
module.exports = factory(); | ||
@@ -10,0 +8,0 @@ } else { |
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
105423
1877