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

vue-resource

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-resource - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

7

dist/vue-resource.js

@@ -367,4 +367,6 @@ /**

promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Vue.url, options).then(transformResponse, transformResponse);
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Vue.url, options);
promise.then(transformResponse, transformResponse);
promise.success = function (fn) {

@@ -374,3 +376,3 @@

fn.call(self, response.data, response.status, response);
});
}, function () {});

@@ -523,3 +525,2 @@ return promise;

return response;
}

@@ -526,0 +527,0 @@

@@ -7,2 +7,2 @@ /**

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.VueResource=t():e.VueResource=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e){e.url=n(1)(e),e.http=n(3)(e),e.resource=n(5)(e)}window.Vue&&Vue.use(r),e.exports=r},function(e,t,n){e.exports=function(e){function t(e,n){var r,a={},i={},c=e;return s.isPlainObject(c)||(c={url:e,params:n}),c=s.extend({},t.options,s.options("url",this,c)),e=c.url.replace(/:([a-z]\w*)/gi,function(e,t){return c.params[t]?(a[t]=!0,o(c.params[t])):""}),"string"!=typeof c.root||e.match(/^(https?:)?\//)||(e=c.root+"/"+e),e=e.replace(/([^:])[\/]{2,}/g,"$1/"),e=e.replace(/(\w+)\/+$/,"$1"),s.each(c.params,function(e,t){a[t]||(i[t]=e)}),r=t.params(i),r&&(e+=(-1==e.indexOf("?")?"?":"&")+r),e}function r(e,t,n){var o,a=s.isArray(t),i=s.isPlainObject(t);s.each(t,function(t,c){o=s.isObject(t)||s.isArray(t),n&&(c=n+"["+(i||o?c:"")+"]"),!n&&a?e.add(t.name,t.value):o?r(e,t,c):e.add(c,t)})}function o(e){return a(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function a(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,t?"%20":"+")}var s=n(2)(e);return t.options={url:"",params:{}},t.params=function(e){var t=[];return t.add=function(e,t){s.isFunction(t)&&(t=t()),null===t&&(t=""),this.push(o(e)+"="+o(t))},r(t,e),t.join("&")},t.parse=function(e){var t=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?"),n=e.match(t);return{url:e,scheme:n[1]||"",host:n[2]||"",path:n[3]||"",query:n[4]||"",fragment:n[5]||""}},Object.defineProperty(e.prototype,"$url",{get:function(){return s.extend(t.bind(this),t)}}),t}},function(e,t){e.exports=function(e){function t(e,r,o){for(var a in r)o&&(n.isPlainObject(r[a])||n.isArray(r[a]))?(n.isPlainObject(r[a])&&!n.isPlainObject(e[a])&&(e[a]={}),n.isArray(r[a])&&!n.isArray(e[a])&&(e[a]=[]),t(e[a],r[a],o)):void 0!==r[a]&&(e[a]=r[a])}var n=e.util.extend({},e.util);return n.options=function(e,t,r){var o=t.$options||{};return n.extend({},o[e],r)},n.each=function(e,t){var r,o;if("number"==typeof e.length)for(r=0;r<e.length;r++)t.call(e[r],e[r],r);else if(n.isObject(e))for(o in e)e.hasOwnProperty(o)&&t.call(e[o],e[o],o);return e},n.extend=function(e){var n,r=[],o=r.slice.call(arguments,1);return"boolean"==typeof e&&(n=e,e=o.shift()),o.forEach(function(r){t(e,r,n)}),e},n.isFunction=function(e){return e&&"function"==typeof e},n}},function(e,t,n){e.exports=function(e){function t(n,i){var c,u,p=this;return i=i||{},s.isPlainObject(n)&&(i=n,n=""),c=s.extend({},t.headers.common,t.headers[i.method.toLowerCase()]),i=s.extend(!0,{url:n,headers:c},t.options,s.options("http",this,i)),s.isPlainObject(i.data)&&/^(get|jsonp)$/i.test(i.method)&&(s.extend(i.params,i.data),i.data=""),u=("jsonp"==i.method.toLowerCase()?o:r).call(this,this.$url||e.url,i).then(a,a),u.success=function(e){return u.then(function(t){e.call(p,t.data,t.status,t)}),u},u.error=function(e){return u["catch"](function(t){e.call(p,t.data,t.status,t)}),u},u.always=function(e){var t=function(t){e.call(p,t.data,t.status,t)};return u.then(t,t),u},i.success&&u.success(i.success),i.error&&u.error(i.error),u}function r(e,t){var n=new XMLHttpRequest;s.isFunction(t.beforeSend)&&t.beforeSend(n,t),t.emulateHTTP&&/^(put|patch|delete)$/i.test(t.method)&&(t.headers["X-HTTP-Method-Override"]=t.method,t.method="post"),t.emulateJSON&&s.isPlainObject(t.data)&&(t.headers["Content-Type"]="application/x-www-form-urlencoded",t.data=e.params(t.data)),s.isObject(t.data)&&/FormData/i.test(t.data.toString())&&delete t.headers["Content-Type"],s.isPlainObject(t.data)&&(t.data=JSON.stringify(t.data));var r=new i(function(r,o){n.open(t.method,e(t),!0),s.each(t.headers,function(e,t){n.setRequestHeader(t,e)}),n.onreadystatechange=function(){4===this.readyState&&(this.status>=200&&this.status<300?r(this):o(this))},n.send(t.data)});return s.extend(r,{abort:function(){n.abort()}}),r}function o(e,t){var n,r,o="_jsonp"+Math.random().toString(36).substr(2);t.params[t.jsonp]=o,s.isFunction(t.beforeSend)&&t.beforeSend({},t);var a=new i(function(a,s){n=document.createElement("script"),n.src=e(t.url,t.params),n.type="text/javascript",n.async=!0,window[o]=function(e){r=e};var i=function(e){delete window[o],document.body.removeChild(n),"load"!==e.type||r||(e.type="error");var t=r?r:e.type,i="error"===e.type?404:200;(200===i?a:s)({responseText:t,status:i})};n.onload=i,n.onerror=i,document.body.appendChild(n)});return a}function a(e){try{e.data=JSON.parse(e.responseText)}catch(t){e.data=e.responseText}return e}var s=n(2)(e),i=n(4),c={"Content-Type":"application/json;charset=utf-8"};return t.options={method:"get",params:{},data:"",jsonp:"callback",beforeSend:null,emulateHTTP:!1,emulateJSON:!1},t.headers={put:c,post:c,patch:c,"delete":c,common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"}},["get","put","post","patch","delete","jsonp"].forEach(function(e){t[e]=function(t,n,r,o){return s.isFunction(n)&&(o=r,r=n,n=void 0),this(t,s.extend({method:e,data:n,success:r},o))}}),Object.defineProperty(e.prototype,"$http",{get:function(){return s.extend(t.bind(this),t)}}),t}},function(e,t){function n(e){e(this.resolve.bind(this),this.reject.bind(this)),this._thens=[]}n.prototype={then:function(e,t,n){this._thens.push({resolve:e,reject:t,progress:n})},"catch":function(e){this._thens.push({reject:e})},resolve:function(e){this._complete("resolve",e)},reject:function(e){this._complete("reject",e)},progress:function(e){for(var t,n=0;t=this._thens[n++];)t.progress&&t.progress(e)},_complete:function(e,t){this.then="resolve"===e?function(e,n){e&&e(t)}:function(e,n){n&&n(t)},this.resolve=this.reject=this.progress=function(){throw new Error("Promise already completed.")};for(var n,r=0;n=this._thens[r++];)n[e]&&n[e](t);delete this._thens}},e.exports=window.Promise?window.Promise:n},function(e,t,n){e.exports=function(e){function t(n,a,s){var i=this,c={};return s=o.extend({},t.actions,s),o.each(s,function(t,s){t=o.extend(!0,{url:n,params:a||{}},t),c[s]=function(){return(i.$http||e.http)(r(t,arguments))}}),c}function r(e,t){var n,r,a,s=o.extend({},e),i={};switch(t.length){case 4:a=t[3],r=t[2];case 3:case 2:if(!o.isFunction(t[1])){i=t[0],n=t[1],r=t[2];break}if(o.isFunction(t[0])){r=t[0],a=t[1];break}r=t[1],a=t[2];case 1:o.isFunction(t[0])?r=t[0]:/^(POST|PUT|PATCH)$/i.test(s.method)?n=t[0]:i=t[0];break;case 0:break;default:throw"Expected up to 4 arguments [params, data, success, error], got "+t.length+" arguments"}return s.url=e.url,s.data=n,s.params=o.extend({},e.params,i),r&&(s.success=r),a&&(s.error=a),s}var o=n(2)(e);return t.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},remove:{method:"DELETE"},"delete":{method:"DELETE"}},Object.defineProperty(e.prototype,"$resource",{get:function(){return t.bind(this)}}),t}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.VueResource=t():e.VueResource=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e){e.url=n(1)(e),e.http=n(3)(e),e.resource=n(5)(e)}window.Vue&&Vue.use(r),e.exports=r},function(e,t,n){e.exports=function(e){function t(e,n){var r,a={},i={},c=e;return s.isPlainObject(c)||(c={url:e,params:n}),c=s.extend({},t.options,s.options("url",this,c)),e=c.url.replace(/:([a-z]\w*)/gi,function(e,t){return c.params[t]?(a[t]=!0,o(c.params[t])):""}),"string"!=typeof c.root||e.match(/^(https?:)?\//)||(e=c.root+"/"+e),e=e.replace(/([^:])[\/]{2,}/g,"$1/"),e=e.replace(/(\w+)\/+$/,"$1"),s.each(c.params,function(e,t){a[t]||(i[t]=e)}),r=t.params(i),r&&(e+=(-1==e.indexOf("?")?"?":"&")+r),e}function r(e,t,n){var o,a=s.isArray(t),i=s.isPlainObject(t);s.each(t,function(t,c){o=s.isObject(t)||s.isArray(t),n&&(c=n+"["+(i||o?c:"")+"]"),!n&&a?e.add(t.name,t.value):o?r(e,t,c):e.add(c,t)})}function o(e){return a(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function a(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,t?"%20":"+")}var s=n(2)(e);return t.options={url:"",params:{}},t.params=function(e){var t=[];return t.add=function(e,t){s.isFunction(t)&&(t=t()),null===t&&(t=""),this.push(o(e)+"="+o(t))},r(t,e),t.join("&")},t.parse=function(e){var t=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?"),n=e.match(t);return{url:e,scheme:n[1]||"",host:n[2]||"",path:n[3]||"",query:n[4]||"",fragment:n[5]||""}},Object.defineProperty(e.prototype,"$url",{get:function(){return s.extend(t.bind(this),t)}}),t}},function(e,t){e.exports=function(e){function t(e,r,o){for(var a in r)o&&(n.isPlainObject(r[a])||n.isArray(r[a]))?(n.isPlainObject(r[a])&&!n.isPlainObject(e[a])&&(e[a]={}),n.isArray(r[a])&&!n.isArray(e[a])&&(e[a]=[]),t(e[a],r[a],o)):void 0!==r[a]&&(e[a]=r[a])}var n=e.util.extend({},e.util);return n.options=function(e,t,r){var o=t.$options||{};return n.extend({},o[e],r)},n.each=function(e,t){var r,o;if("number"==typeof e.length)for(r=0;r<e.length;r++)t.call(e[r],e[r],r);else if(n.isObject(e))for(o in e)e.hasOwnProperty(o)&&t.call(e[o],e[o],o);return e},n.extend=function(e){var n,r=[],o=r.slice.call(arguments,1);return"boolean"==typeof e&&(n=e,e=o.shift()),o.forEach(function(r){t(e,r,n)}),e},n.isFunction=function(e){return e&&"function"==typeof e},n}},function(e,t,n){e.exports=function(e){function t(n,i){var c,u,p=this;return i=i||{},s.isPlainObject(n)&&(i=n,n=""),c=s.extend({},t.headers.common,t.headers[i.method.toLowerCase()]),i=s.extend(!0,{url:n,headers:c},t.options,s.options("http",this,i)),s.isPlainObject(i.data)&&/^(get|jsonp)$/i.test(i.method)&&(s.extend(i.params,i.data),i.data=""),u=("jsonp"==i.method.toLowerCase()?o:r).call(this,this.$url||e.url,i),u.then(a,a),u.success=function(e){return u.then(function(t){e.call(p,t.data,t.status,t)},function(){}),u},u.error=function(e){return u["catch"](function(t){e.call(p,t.data,t.status,t)}),u},u.always=function(e){var t=function(t){e.call(p,t.data,t.status,t)};return u.then(t,t),u},i.success&&u.success(i.success),i.error&&u.error(i.error),u}function r(e,t){var n=new XMLHttpRequest;s.isFunction(t.beforeSend)&&t.beforeSend(n,t),t.emulateHTTP&&/^(put|patch|delete)$/i.test(t.method)&&(t.headers["X-HTTP-Method-Override"]=t.method,t.method="post"),t.emulateJSON&&s.isPlainObject(t.data)&&(t.headers["Content-Type"]="application/x-www-form-urlencoded",t.data=e.params(t.data)),s.isObject(t.data)&&/FormData/i.test(t.data.toString())&&delete t.headers["Content-Type"],s.isPlainObject(t.data)&&(t.data=JSON.stringify(t.data));var r=new i(function(r,o){n.open(t.method,e(t),!0),s.each(t.headers,function(e,t){n.setRequestHeader(t,e)}),n.onreadystatechange=function(){4===this.readyState&&(this.status>=200&&this.status<300?r(this):o(this))},n.send(t.data)});return s.extend(r,{abort:function(){n.abort()}}),r}function o(e,t){var n,r,o="_jsonp"+Math.random().toString(36).substr(2);t.params[t.jsonp]=o,s.isFunction(t.beforeSend)&&t.beforeSend({},t);var a=new i(function(a,s){n=document.createElement("script"),n.src=e(t.url,t.params),n.type="text/javascript",n.async=!0,window[o]=function(e){r=e};var i=function(e){delete window[o],document.body.removeChild(n),"load"!==e.type||r||(e.type="error");var t=r?r:e.type,i="error"===e.type?404:200;(200===i?a:s)({responseText:t,status:i})};n.onload=i,n.onerror=i,document.body.appendChild(n)});return a}function a(e){try{e.data=JSON.parse(e.responseText)}catch(t){e.data=e.responseText}}var s=n(2)(e),i=n(4),c={"Content-Type":"application/json;charset=utf-8"};return t.options={method:"get",params:{},data:"",jsonp:"callback",beforeSend:null,emulateHTTP:!1,emulateJSON:!1},t.headers={put:c,post:c,patch:c,"delete":c,common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"}},["get","put","post","patch","delete","jsonp"].forEach(function(e){t[e]=function(t,n,r,o){return s.isFunction(n)&&(o=r,r=n,n=void 0),this(t,s.extend({method:e,data:n,success:r},o))}}),Object.defineProperty(e.prototype,"$http",{get:function(){return s.extend(t.bind(this),t)}}),t}},function(e,t){function n(e){e(this.resolve.bind(this),this.reject.bind(this)),this._thens=[]}n.prototype={then:function(e,t,n){this._thens.push({resolve:e,reject:t,progress:n})},"catch":function(e){this._thens.push({reject:e})},resolve:function(e){this._complete("resolve",e)},reject:function(e){this._complete("reject",e)},progress:function(e){for(var t,n=0;t=this._thens[n++];)t.progress&&t.progress(e)},_complete:function(e,t){this.then="resolve"===e?function(e,n){e&&e(t)}:function(e,n){n&&n(t)},this.resolve=this.reject=this.progress=function(){throw new Error("Promise already completed.")};for(var n,r=0;n=this._thens[r++];)n[e]&&n[e](t);delete this._thens}},e.exports=window.Promise?window.Promise:n},function(e,t,n){e.exports=function(e){function t(n,a,s){var i=this,c={};return s=o.extend({},t.actions,s),o.each(s,function(t,s){t=o.extend(!0,{url:n,params:a||{}},t),c[s]=function(){return(i.$http||e.http)(r(t,arguments))}}),c}function r(e,t){var n,r,a,s=o.extend({},e),i={};switch(t.length){case 4:a=t[3],r=t[2];case 3:case 2:if(!o.isFunction(t[1])){i=t[0],n=t[1],r=t[2];break}if(o.isFunction(t[0])){r=t[0],a=t[1];break}r=t[1],a=t[2];case 1:o.isFunction(t[0])?r=t[0]:/^(POST|PUT|PATCH)$/i.test(s.method)?n=t[0]:i=t[0];break;case 0:break;default:throw"Expected up to 4 arguments [params, data, success, error], got "+t.length+" arguments"}return s.url=e.url,s.data=n,s.params=o.extend({},e.params,i),r&&(s.success=r),a&&(s.error=a),s}var o=n(2)(e);return t.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},remove:{method:"DELETE"},"delete":{method:"DELETE"}},Object.defineProperty(e.prototype,"$resource",{get:function(){return t.bind(this)}}),t}}])});
{
"name": "vue-resource",
"version": "0.1.7",
"version": "0.1.8",
"description": "A web request service for Vue.js",

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

@@ -36,4 +36,6 @@ module.exports = function (Vue) {

promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Vue.url, options).then(transformResponse, transformResponse);
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Vue.url, options);
promise.then(transformResponse, transformResponse);
promise.success = function (fn) {

@@ -43,3 +45,3 @@

fn.call(self, response.data, response.status, response);
});
}, function () {});

@@ -192,3 +194,2 @@ return promise;

return response;
}

@@ -195,0 +196,0 @@

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