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

kitsu

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitsu - npm Package Compare versions

Comparing version 4.5.3 to 4.6.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

### 4.6.0 (2018-02-12)
##### Chores
* **deps:** update documentation to ~5.4.0 ([#122](https://github.com/wopian/kitsu/pull/122)) ([d91434ee](https://github.com/wopian/kitsu/commit/d91434ee3e42b77f92358ba825d6accedfefe95e))
##### New Features
* include meta from relationships ([#118](https://github.com/wopian/kitsu/pull/118)) ([1add511c](https://github.com/wopian/kitsu/commit/1add511c552150421b91979da5d8cc160bc7b7f8))
#### 4.5.3 (2018-02-10)

@@ -2,0 +12,0 @@

2

lib/kitsu.js

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

(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios'],b):a.Kitsu=b(a._regeneratorRuntime,a._asyncToGenerator,a._slicedToArray,a._classCallCheck,a._createClass,a.axios)})(this,function(a,b,c,d,e,f){'use strict';function g(a){if(a.response){var b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function h(a){var b='',c=function(c){'object'==typeof a[c]?Object.keys(a[c]).forEach(function(d){b+=`&${c}[${d}]=${a[c][d]}`}):b+=`&${c}=${a[c]}`};for(var d in a)c(d);return a?b.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f;var i=function(){var c=b(a.mark(function c(d){var e=this;return a.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if('object'!=typeof d||null===d){c.next=7;break}if(!Array.isArray(d)){c.next=6;break}return c.next=4,d.map(function(){var c=b(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt('return',i(c));case 1:case'end':return a.stop();}},b,e)}));return function(){return c.apply(this,arguments)}}());case 4:c.next=7;break;case 6:d.attributes&&d.attributes.constructor===Object&&(Object.keys(d.attributes).forEach(function(a){d[a]=d.attributes[a]}),delete d.attributes);case 7:return c.abrupt('return',d);case 8:case'end':return c.stop();}},c,this)}));return function(){return c.apply(this,arguments)}}(),j=function(){var c=b(a.mark(function b(c){var d,e,f,g,h,j;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=!0,e=!1,f=void 0,a.prev=3,a.next=6,c.data;case 6:a.t0=Symbol.iterator,g=a.sent[a.t0]();case 8:if(d=(h=g.next()).done){a.next=22;break}if(j=h.value,!c.included){a.next=14;break}return a.next=13,p(j,c.included);case 13:j=a.sent;case 14:if(!j.attributes){a.next=18;break}return a.next=17,i(j);case 17:j=a.sent;case 18:c.data[c.data.indexOf(j)]=j;case 19:d=!0,a.next=8;break;case 22:a.next=28;break;case 24:a.prev=24,a.t1=a['catch'](3),e=!0,f=a.t1;case 28:a.prev=28,a.prev=29,!d&&g.return&&g.return();case 31:if(a.prev=31,!e){a.next=34;break}throw f;case 34:return a.finish(31);case 35:return a.finish(28);case 36:return a.abrupt('return',c);case 37:case'end':return a.stop();}},b,this,[[3,24,28,36],[29,,31,35]])}));return function(){return c.apply(this,arguments)}}(),k=function(){var c=b(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!(c.data&&c.data.constructor===Array)){a.next=6;break}return a.next=3,j(c);case 3:c=a.sent,a.next=10;break;case 6:if(!c.included){a.next=10;break}return a.next=9,p(c.data,c.included);case 9:c.data=a.sent;case 10:if(delete c.included,!c.data.attributes){a.next=15;break}return a.next=14,i(c.data);case 14:c.data=a.sent;case 15:return a.abrupt('return',c);case 16:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),l=function(){var c=b(a.mark(function b(c,d){var e=d.id,f=d.type;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.abrupt('return',c.filter(function(a){return a.id===e&&a.type===f})[0]||{id:e,type:f});case 4:a.prev=4,a.t0=a['catch'](0),g(a.t0);case 7:case'end':return a.stop();}},b,this,[[0,4]])}));return function(){return c.apply(this,arguments)}}(),m=function(){var c=b(a.mark(function b(c,d,e){var f;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,l(e,{id:c,type:d});case 2:if(f=a.sent,!f.relationships){a.next=6;break}return a.next=6,p(f,e);case 6:return a.abrupt('return',i(f));case 7:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),n=function(){var c=b(a.mark(function b(c,d,e){var f,g,h,i,j,k,l,n;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c[e]=[],f=!0,g=!1,h=void 0,a.prev=4,a.next=7,c.relationships[e].data;case 7:a.t0=Symbol.iterator,i=a.sent[a.t0]();case 9:if(f=(j=i.next()).done){a.next=20;break}return k=j.value,l=k.id,n=k.type,a.t1=c[e],a.next=15,m(l,n,d);case 15:a.t2=a.sent,a.t1.push.call(a.t1,a.t2);case 17:f=!0,a.next=9;break;case 20:a.next=26;break;case 22:a.prev=22,a.t3=a['catch'](4),g=!0,h=a.t3;case 26:a.prev=26,a.prev=27,!f&&i.return&&i.return();case 29:if(a.prev=29,!g){a.next=32;break}throw h;case 32:return a.finish(29);case 33:return a.finish(26);case 34:case'end':return a.stop();}},b,this,[[4,22,26,34],[27,,29,33]])}));return function(){return c.apply(this,arguments)}}(),o=function(){var c=b(a.mark(function b(c,d,e){var f,g,h;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return f=c.relationships[e].data,g=f.id,h=f.type,a.next=3,m(g,h,d);case 3:c[e]=a.sent,delete c[e].relationships;case 5:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),p=function(){var c=b(a.mark(function b(c,d){var e,f,g;return a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e=c.relationships,f=!1,b.next=4,e;case 4:b.t0=a.keys(b.sent);case 5:if((b.t1=b.t0()).done){b.next=19;break}if(g=b.t1.value,!(e[g].data&&Array.isArray(e[g].data))){b.next=13;break}return b.next=10,n(c,d,g);case 10:f=!0,b.next=17;break;case 13:if(!e[g].data){b.next=17;break}return b.next=16,o(c,d,g);case 16:f=!0;case 17:b.next=5;break;case 19:return f&&delete c.relationships,b.abrupt('return',c);case 21:case'end':return b.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),q=function(){var c=b(a.mark(function b(c){var d,e,f,h,i=this,j=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:'POST';return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,j.constructor===Object&&0!==Object.keys(j).length){a.next=3;break}throw new Error(`${k} requires a JSON object body`);case 3:if(d=this.plural(this.camel(c)),e={type:d},'POST'===k||'undefined'!=typeof j.id){a.next=7;break}throw new Error(`${k} requires an ID for the ${d} type`);case 7:for(h in'POST'!==k&&(e.id=j.id.toString()),f=function(a){if(null!==j[a]&&j[a].constructor===Object){if('string'==typeof j[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof j[a].type&&(j[a].type=i.plural(i.camel(a))),e.relationships[a]={data:Object.assign(j[a])};else throw new Error(`${k} requires an ID for the ${a} relationships`);}else if(null!==j[a]&&Array.isArray(j[a])){var b=i.plural(i.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:j[a].map(function(c){if('undefined'==typeof c.id)throw new Error(`${k} requires an ID for the ${a} relationships`);return{id:c.id,type:c.type||b}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=j[a])},j)f(h);return a.abrupt('return',{data:e});case 13:throw a.prev=13,a.t0=a['catch'](0),g(a.t0);case 16:case'end':return a.stop();}},b,this,[[0,13]])}));return function(){return c.apply(this,arguments)}}(),r=function(a){return a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,function(a){return a.slice(1).toUpperCase()})},s=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'-'+a.toLowerCase()})},t=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'_'+a.toLowerCase()})},u=function(){function i(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d(this,i),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?function(a){return a}:r,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?t:s,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=f.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return e(i,[{key:'get',value:function(){var d=b(a.mark(function b(d){var e,f,i,j,l,m,n,o,p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},q=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=d.split('/'),f=c(e,3),i=f[0],j=f[1],l=f[2],m=this.plural(this.resCase(i)),j&&(m+=`/${j}`),l&&(m+=`/${this.resCase(l)}`),a.next=7,this.axios.get(m,{params:p,paramsSerializer:function(a){return h(a)},headers:Object.assign(this.headers,q)});case 7:return n=a.sent,o=n.data,a.abrupt('return',k(o));case 12:throw a.prev=12,a.t0=a['catch'](0),g(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return d.apply(this,arguments)}}()},{key:'patch',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,q.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return h=a.sent,i=h.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),g(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return c.apply(this,arguments)}}()},{key:'post',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,q.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,h=f.data,a.abrupt('return',h);case 15:throw a.prev=15,a.t4=a['catch'](0),g(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return c.apply(this,arguments)}}()},{key:'remove',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,q.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,h=f.data,a.abrupt('return',h);case 16:throw a.prev=16,a.t5=a['catch'](0),g(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return c.apply(this,arguments)}}()},{key:'self',value:function(){var c=b(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),g(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return c.apply(this,arguments)}}()},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),i}();return u});
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios'],b):a.Kitsu=b(a._regeneratorRuntime,a._asyncToGenerator,a._slicedToArray,a._classCallCheck,a._createClass,a.axios)})(this,function(a,b,c,d,e,f){'use strict';function g(a){if(a.response){var b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function h(a){var b='',c=function(c){'object'==typeof a[c]?Object.keys(a[c]).forEach(function(d){b+=`&${c}[${d}]=${a[c][d]}`}):b+=`&${c}=${a[c]}`};for(var d in a)c(d);return a?b.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f;var i=function(){var c=b(a.mark(function c(d){var e=this;return a.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if('object'!=typeof d||null===d){c.next=7;break}if(!Array.isArray(d)){c.next=6;break}return c.next=4,d.map(function(){var c=b(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt('return',i(c));case 1:case'end':return a.stop();}},b,e)}));return function(){return c.apply(this,arguments)}}());case 4:c.next=7;break;case 6:d.attributes&&d.attributes.constructor===Object&&(Object.keys(d.attributes).forEach(function(a){d[a]=d.attributes[a]}),delete d.attributes);case 7:return c.abrupt('return',d);case 8:case'end':return c.stop();}},c,this)}));return function(){return c.apply(this,arguments)}}(),j=function(){var c=b(a.mark(function b(c){var d,e,f,g,h,j;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=!0,e=!1,f=void 0,a.prev=3,a.next=6,c.data;case 6:a.t0=Symbol.iterator,g=a.sent[a.t0]();case 8:if(d=(h=g.next()).done){a.next=22;break}if(j=h.value,!c.included){a.next=14;break}return a.next=13,p(j,c.included);case 13:j=a.sent;case 14:if(!j.attributes){a.next=18;break}return a.next=17,i(j);case 17:j=a.sent;case 18:c.data[c.data.indexOf(j)]=j;case 19:d=!0,a.next=8;break;case 22:a.next=28;break;case 24:a.prev=24,a.t1=a['catch'](3),e=!0,f=a.t1;case 28:a.prev=28,a.prev=29,!d&&g.return&&g.return();case 31:if(a.prev=31,!e){a.next=34;break}throw f;case 34:return a.finish(31);case 35:return a.finish(28);case 36:return a.abrupt('return',c);case 37:case'end':return a.stop();}},b,this,[[3,24,28,36],[29,,31,35]])}));return function(){return c.apply(this,arguments)}}(),k=function(){var c=b(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!(c.data&&c.data.constructor===Array)){a.next=6;break}return a.next=3,j(c);case 3:c=a.sent,a.next=10;break;case 6:if(!c.included){a.next=10;break}return a.next=9,p(c.data,c.included);case 9:c.data=a.sent;case 10:if(delete c.included,!c.data.attributes){a.next=15;break}return a.next=14,i(c.data);case 14:c.data=a.sent;case 15:return a.abrupt('return',c);case 16:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),l=function(){var c=b(a.mark(function b(c,d){var e,f=d.id,h=d.type;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=c.filter(function(a){return a.id===f&&a.type===h})[0]||{id:f,type:h},a.abrupt('return',Object.assign({},e));case 5:a.prev=5,a.t0=a['catch'](0),g(a.t0);case 8:case'end':return a.stop();}},b,this,[[0,5]])}));return function(){return c.apply(this,arguments)}}(),m=function(){var c=b(a.mark(function b(c,d){var e,f=c.id,g=c.type,h=c.meta;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,l(d,{id:f,type:g});case 2:if(e=a.sent,!e.relationships){a.next=6;break}return a.next=6,p(e,d);case 6:return h&&(e.meta=h),a.abrupt('return',i(e));case 8:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),n=function(){var c=b(a.mark(function b(c,d,e){var f,g,h,i,j,k;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c[e]=[],f=!0,g=!1,h=void 0,a.prev=4,a.next=7,c.relationships[e].data;case 7:a.t0=Symbol.iterator,i=a.sent[a.t0]();case 9:if(f=(j=i.next()).done){a.next=19;break}return k=j.value,a.t1=c[e],a.next=14,m(k,d);case 14:a.t2=a.sent,a.t1.push.call(a.t1,a.t2);case 16:f=!0,a.next=9;break;case 19:a.next=25;break;case 21:a.prev=21,a.t3=a['catch'](4),g=!0,h=a.t3;case 25:a.prev=25,a.prev=26,!f&&i.return&&i.return();case 28:if(a.prev=28,!g){a.next=31;break}throw h;case 31:return a.finish(28);case 32:return a.finish(25);case 33:case'end':return a.stop();}},b,this,[[4,21,25,33],[26,,28,32]])}));return function(){return c.apply(this,arguments)}}(),o=function(){var c=b(a.mark(function b(c,d,e){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,m(c.relationships[e].data,d);case 2:c[e]=a.sent,delete c[e].relationships;case 4:case'end':return a.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),p=function(){var c=b(a.mark(function b(c,d){var e,f,g;return a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e=c.relationships,f=!1,b.next=4,e;case 4:b.t0=a.keys(b.sent);case 5:if((b.t1=b.t0()).done){b.next=19;break}if(g=b.t1.value,!(e[g].data&&Array.isArray(e[g].data))){b.next=13;break}return b.next=10,n(c,d,g);case 10:f=!0,b.next=17;break;case 13:if(!e[g].data){b.next=17;break}return b.next=16,o(c,d,g);case 16:f=!0;case 17:b.next=5;break;case 19:return f&&delete c.relationships,b.abrupt('return',c);case 21:case'end':return b.stop();}},b,this)}));return function(){return c.apply(this,arguments)}}(),q=function(){var c=b(a.mark(function b(c){var d,e,f,h,i=this,j=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:'POST';return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,j.constructor===Object&&0!==Object.keys(j).length){a.next=3;break}throw new Error(`${k} requires a JSON object body`);case 3:if(d=this.plural(this.camel(c)),e={type:d},'POST'===k||'undefined'!=typeof j.id){a.next=7;break}throw new Error(`${k} requires an ID for the ${d} type`);case 7:for(h in'POST'!==k&&(e.id=j.id.toString()),f=function(a){if(null!==j[a]&&j[a].constructor===Object){if('string'==typeof j[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof j[a].type&&(j[a].type=i.plural(i.camel(a))),e.relationships[a]={data:Object.assign(j[a])};else throw new Error(`${k} requires an ID for the ${a} relationships`);}else if(null!==j[a]&&Array.isArray(j[a])){var b=i.plural(i.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:j[a].map(function(c){if('undefined'==typeof c.id)throw new Error(`${k} requires an ID for the ${a} relationships`);return{id:c.id,type:c.type||b}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=j[a])},j)f(h);return a.abrupt('return',{data:e});case 13:throw a.prev=13,a.t0=a['catch'](0),g(a.t0);case 16:case'end':return a.stop();}},b,this,[[0,13]])}));return function(){return c.apply(this,arguments)}}(),r=function(a){return a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,function(a){return a.slice(1).toUpperCase()})},s=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'-'+a.toLowerCase()})},t=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'_'+a.toLowerCase()})},u=function(){function i(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d(this,i),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?function(a){return a}:r,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?t:s,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=f.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return e(i,[{key:'get',value:function(){var d=b(a.mark(function b(d){var e,f,i,j,l,m,n,o,p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},q=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=d.split('/'),f=c(e,3),i=f[0],j=f[1],l=f[2],m=this.plural(this.resCase(i)),j&&(m+=`/${j}`),l&&(m+=`/${this.resCase(l)}`),a.next=7,this.axios.get(m,{params:p,paramsSerializer:function(a){return h(a)},headers:Object.assign(this.headers,q)});case 7:return n=a.sent,o=n.data,a.abrupt('return',k(o));case 12:throw a.prev=12,a.t0=a['catch'](0),g(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return d.apply(this,arguments)}}()},{key:'patch',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,q.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return h=a.sent,i=h.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),g(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return c.apply(this,arguments)}}()},{key:'post',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,q.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,h=f.data,a.abrupt('return',h);case 15:throw a.prev=15,a.t4=a['catch'](0),g(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return c.apply(this,arguments)}}()},{key:'remove',value:function(){var c=b(a.mark(function b(c,d){var e,f,h,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,q.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,h=f.data,a.abrupt('return',h);case 16:throw a.prev=16,a.t5=a['catch'](0),g(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return c.apply(this,arguments)}}()},{key:'self',value:function(){var c=b(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),g(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return c.apply(this,arguments)}}()},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),i}();return u});
//# sourceMappingURL=kitsu.js.map

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

(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/typeof'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/typeof','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios'],b):a.Kitsu=b(a._regeneratorRuntime,a._typeof,a._asyncToGenerator,a._slicedToArray,a._classCallCheck,a._createClass,a.axios)})(this,function(a,b,c,d,e,f,g){'use strict';function h(a){if(a.response){var b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function i(a){var c='',d=function(d){'object'===b(a[d])?Object.keys(a[d]).forEach(function(b){c+='&'+d+'['+b+']='+a[d][b]}):c+='&'+d+'='+a[d]};for(var e in a)d(e);return a?c.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f,g=g&&g.hasOwnProperty('default')?g['default']:g;var j=function(){var d=c(a.mark(function d(e){var f=this;return a.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if('object'!==('undefined'==typeof e?'undefined':b(e))||null===e){d.next=7;break}if(!Array.isArray(e)){d.next=6;break}return d.next=4,e.map(function(){var b=c(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt('return',j(c));case 1:case'end':return a.stop();}},b,f)}));return function(){return b.apply(this,arguments)}}());case 4:d.next=7;break;case 6:e.attributes&&e.attributes.constructor===Object&&(Object.keys(e.attributes).forEach(function(a){e[a]=e.attributes[a]}),delete e.attributes);case 7:return d.abrupt('return',e);case 8:case'end':return d.stop();}},d,this)}));return function(){return d.apply(this,arguments)}}(),k=function(){var b=c(a.mark(function b(c){var d,e,f,g,h,i;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=!0,e=!1,f=void 0,a.prev=3,a.next=6,c.data;case 6:a.t0=Symbol.iterator,g=a.sent[a.t0]();case 8:if(d=(h=g.next()).done){a.next=22;break}if(i=h.value,!c.included){a.next=14;break}return a.next=13,q(i,c.included);case 13:i=a.sent;case 14:if(!i.attributes){a.next=18;break}return a.next=17,j(i);case 17:i=a.sent;case 18:c.data[c.data.indexOf(i)]=i;case 19:d=!0,a.next=8;break;case 22:a.next=28;break;case 24:a.prev=24,a.t1=a['catch'](3),e=!0,f=a.t1;case 28:a.prev=28,a.prev=29,!d&&g.return&&g.return();case 31:if(a.prev=31,!e){a.next=34;break}throw f;case 34:return a.finish(31);case 35:return a.finish(28);case 36:return a.abrupt('return',c);case 37:case'end':return a.stop();}},b,this,[[3,24,28,36],[29,,31,35]])}));return function(){return b.apply(this,arguments)}}(),l=function(){var b=c(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!(c.data&&c.data.constructor===Array)){a.next=6;break}return a.next=3,k(c);case 3:c=a.sent,a.next=10;break;case 6:if(!c.included){a.next=10;break}return a.next=9,q(c.data,c.included);case 9:c.data=a.sent;case 10:if(delete c.included,!c.data.attributes){a.next=15;break}return a.next=14,j(c.data);case 14:c.data=a.sent;case 15:return a.abrupt('return',c);case 16:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),m=function(){var b=c(a.mark(function b(c,d){var e=d.id,f=d.type;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.abrupt('return',c.filter(function(a){return a.id===e&&a.type===f})[0]||{id:e,type:f});case 4:a.prev=4,a.t0=a['catch'](0),h(a.t0);case 7:case'end':return a.stop();}},b,this,[[0,4]])}));return function(){return b.apply(this,arguments)}}(),n=function(){var b=c(a.mark(function b(c,d,e){var f;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,m(e,{id:c,type:d});case 2:if(f=a.sent,!f.relationships){a.next=6;break}return a.next=6,q(f,e);case 6:return a.abrupt('return',j(f));case 7:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),o=function(){var b=c(a.mark(function b(c,d,e){var f,g,h,i,j,k,l,m;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c[e]=[],f=!0,g=!1,h=void 0,a.prev=4,a.next=7,c.relationships[e].data;case 7:a.t0=Symbol.iterator,i=a.sent[a.t0]();case 9:if(f=(j=i.next()).done){a.next=20;break}return k=j.value,l=k.id,m=k.type,a.t1=c[e],a.next=15,n(l,m,d);case 15:a.t2=a.sent,a.t1.push.call(a.t1,a.t2);case 17:f=!0,a.next=9;break;case 20:a.next=26;break;case 22:a.prev=22,a.t3=a['catch'](4),g=!0,h=a.t3;case 26:a.prev=26,a.prev=27,!f&&i.return&&i.return();case 29:if(a.prev=29,!g){a.next=32;break}throw h;case 32:return a.finish(29);case 33:return a.finish(26);case 34:case'end':return a.stop();}},b,this,[[4,22,26,34],[27,,29,33]])}));return function(){return b.apply(this,arguments)}}(),p=function(){var b=c(a.mark(function b(c,d,e){var f,g,h;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return f=c.relationships[e].data,g=f.id,h=f.type,a.next=3,n(g,h,d);case 3:c[e]=a.sent,delete c[e].relationships;case 5:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),q=function(){var b=c(a.mark(function b(c,d){var e,f,g;return a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e=c.relationships,f=!1,b.next=4,e;case 4:b.t0=a.keys(b.sent);case 5:if((b.t1=b.t0()).done){b.next=19;break}if(g=b.t1.value,!(e[g].data&&Array.isArray(e[g].data))){b.next=13;break}return b.next=10,o(c,d,g);case 10:f=!0,b.next=17;break;case 13:if(!e[g].data){b.next=17;break}return b.next=16,p(c,d,g);case 16:f=!0;case 17:b.next=5;break;case 19:return f&&delete c.relationships,b.abrupt('return',c);case 21:case'end':return b.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),r=function(){var b=c(a.mark(function b(c){var d,e,f,g,i=this,j=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:'POST';return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,j.constructor===Object&&0!==Object.keys(j).length){a.next=3;break}throw new Error(k+' requires a JSON object body');case 3:if(d=this.plural(this.camel(c)),e={type:d},'POST'===k||'undefined'!=typeof j.id){a.next=7;break}throw new Error(k+' requires an ID for the '+d+' type');case 7:for(g in'POST'!==k&&(e.id=j.id.toString()),f=function(a){if(null!==j[a]&&j[a].constructor===Object){if('string'==typeof j[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof j[a].type&&(j[a].type=i.plural(i.camel(a))),e.relationships[a]={data:Object.assign(j[a])};else throw new Error(k+' requires an ID for the '+a+' relationships');}else if(null!==j[a]&&Array.isArray(j[a])){var b=i.plural(i.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:j[a].map(function(c){if('undefined'==typeof c.id)throw new Error(k+' requires an ID for the '+a+' relationships');return{id:c.id,type:c.type||b}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=j[a])},j)f(g);return a.abrupt('return',{data:e});case 13:throw a.prev=13,a.t0=a['catch'](0),h(a.t0);case 16:case'end':return a.stop();}},b,this,[[0,13]])}));return function(){return b.apply(this,arguments)}}(),s=function(a){return a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,function(a){return a.slice(1).toUpperCase()})},t=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'-'+a.toLowerCase()})},u=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'_'+a.toLowerCase()})},v=function(){function b(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e(this,b),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?function(a){return a}:s,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?u:t,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=g.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return f(b,[{key:'get',value:function(){var b=c(a.mark(function b(c){var e,f,g,j,k,m,n,o,p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},q=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=c.split('/'),f=d(e,3),g=f[0],j=f[1],k=f[2],m=this.plural(this.resCase(g)),j&&(m+='/'+j),k&&(m+='/'+this.resCase(k)),a.next=7,this.axios.get(m,{params:p,paramsSerializer:function(a){return i(a)},headers:Object.assign(this.headers,q)});case 7:return n=a.sent,o=n.data,a.abrupt('return',l(o));case 12:throw a.prev=12,a.t0=a['catch'](0),h(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'patch',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,r.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return g=a.sent,i=g.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),h(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'post',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,r.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,g=f.data,a.abrupt('return',g);case 15:throw a.prev=15,a.t4=a['catch'](0),h(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return b.apply(this,arguments)}}()},{key:'remove',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,r.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,g=f.data,a.abrupt('return',g);case 16:throw a.prev=16,a.t5=a['catch'](0),h(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return b.apply(this,arguments)}}()},{key:'self',value:function(){var b=c(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),h(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return b.apply(this,arguments)}}()},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),b}();return v});
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/regenerator'),require('babel-runtime/helpers/typeof'),require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/regenerator','babel-runtime/helpers/typeof','babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios'],b):a.Kitsu=b(a._regeneratorRuntime,a._typeof,a._asyncToGenerator,a._slicedToArray,a._classCallCheck,a._createClass,a.axios)})(this,function(a,b,c,d,e,f,g){'use strict';function h(a){if(a.response){var b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function i(a){var c='',d=function(d){'object'===b(a[d])?Object.keys(a[d]).forEach(function(b){c+='&'+d+'['+b+']='+a[d][b]}):c+='&'+d+'='+a[d]};for(var e in a)d(e);return a?c.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f,g=g&&g.hasOwnProperty('default')?g['default']:g;var j=function(){var d=c(a.mark(function d(e){var f=this;return a.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if('object'!==('undefined'==typeof e?'undefined':b(e))||null===e){d.next=7;break}if(!Array.isArray(e)){d.next=6;break}return d.next=4,e.map(function(){var b=c(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt('return',j(c));case 1:case'end':return a.stop();}},b,f)}));return function(){return b.apply(this,arguments)}}());case 4:d.next=7;break;case 6:e.attributes&&e.attributes.constructor===Object&&(Object.keys(e.attributes).forEach(function(a){e[a]=e.attributes[a]}),delete e.attributes);case 7:return d.abrupt('return',e);case 8:case'end':return d.stop();}},d,this)}));return function(){return d.apply(this,arguments)}}(),k=function(){var b=c(a.mark(function b(c){var d,e,f,g,h,i;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=!0,e=!1,f=void 0,a.prev=3,a.next=6,c.data;case 6:a.t0=Symbol.iterator,g=a.sent[a.t0]();case 8:if(d=(h=g.next()).done){a.next=22;break}if(i=h.value,!c.included){a.next=14;break}return a.next=13,q(i,c.included);case 13:i=a.sent;case 14:if(!i.attributes){a.next=18;break}return a.next=17,j(i);case 17:i=a.sent;case 18:c.data[c.data.indexOf(i)]=i;case 19:d=!0,a.next=8;break;case 22:a.next=28;break;case 24:a.prev=24,a.t1=a['catch'](3),e=!0,f=a.t1;case 28:a.prev=28,a.prev=29,!d&&g.return&&g.return();case 31:if(a.prev=31,!e){a.next=34;break}throw f;case 34:return a.finish(31);case 35:return a.finish(28);case 36:return a.abrupt('return',c);case 37:case'end':return a.stop();}},b,this,[[3,24,28,36],[29,,31,35]])}));return function(){return b.apply(this,arguments)}}(),l=function(){var b=c(a.mark(function b(c){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!(c.data&&c.data.constructor===Array)){a.next=6;break}return a.next=3,k(c);case 3:c=a.sent,a.next=10;break;case 6:if(!c.included){a.next=10;break}return a.next=9,q(c.data,c.included);case 9:c.data=a.sent;case 10:if(delete c.included,!c.data.attributes){a.next=15;break}return a.next=14,j(c.data);case 14:c.data=a.sent;case 15:return a.abrupt('return',c);case 16:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),m=function(){var b=c(a.mark(function b(c,d){var e,f=d.id,g=d.type;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=c.filter(function(a){return a.id===f&&a.type===g})[0]||{id:f,type:g},a.abrupt('return',Object.assign({},e));case 5:a.prev=5,a.t0=a['catch'](0),h(a.t0);case 8:case'end':return a.stop();}},b,this,[[0,5]])}));return function(){return b.apply(this,arguments)}}(),n=function(){var b=c(a.mark(function b(c,d){var e,f=c.id,g=c.type,h=c.meta;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,m(d,{id:f,type:g});case 2:if(e=a.sent,!e.relationships){a.next=6;break}return a.next=6,q(e,d);case 6:return h&&(e.meta=h),a.abrupt('return',j(e));case 8:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),o=function(){var b=c(a.mark(function b(c,d,e){var f,g,h,i,j,k;return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c[e]=[],f=!0,g=!1,h=void 0,a.prev=4,a.next=7,c.relationships[e].data;case 7:a.t0=Symbol.iterator,i=a.sent[a.t0]();case 9:if(f=(j=i.next()).done){a.next=19;break}return k=j.value,a.t1=c[e],a.next=14,n(k,d);case 14:a.t2=a.sent,a.t1.push.call(a.t1,a.t2);case 16:f=!0,a.next=9;break;case 19:a.next=25;break;case 21:a.prev=21,a.t3=a['catch'](4),g=!0,h=a.t3;case 25:a.prev=25,a.prev=26,!f&&i.return&&i.return();case 28:if(a.prev=28,!g){a.next=31;break}throw h;case 31:return a.finish(28);case 32:return a.finish(25);case 33:case'end':return a.stop();}},b,this,[[4,21,25,33],[26,,28,32]])}));return function(){return b.apply(this,arguments)}}(),p=function(){var b=c(a.mark(function b(c,d,e){return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,n(c.relationships[e].data,d);case 2:c[e]=a.sent,delete c[e].relationships;case 4:case'end':return a.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),q=function(){var b=c(a.mark(function b(c,d){var e,f,g;return a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e=c.relationships,f=!1,b.next=4,e;case 4:b.t0=a.keys(b.sent);case 5:if((b.t1=b.t0()).done){b.next=19;break}if(g=b.t1.value,!(e[g].data&&Array.isArray(e[g].data))){b.next=13;break}return b.next=10,o(c,d,g);case 10:f=!0,b.next=17;break;case 13:if(!e[g].data){b.next=17;break}return b.next=16,p(c,d,g);case 16:f=!0;case 17:b.next=5;break;case 19:return f&&delete c.relationships,b.abrupt('return',c);case 21:case'end':return b.stop();}},b,this)}));return function(){return b.apply(this,arguments)}}(),r=function(){var b=c(a.mark(function b(c){var d,e,f,g,i=this,j=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},k=2<arguments.length&&arguments[2]!==void 0?arguments[2]:'POST';return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,j.constructor===Object&&0!==Object.keys(j).length){a.next=3;break}throw new Error(k+' requires a JSON object body');case 3:if(d=this.plural(this.camel(c)),e={type:d},'POST'===k||'undefined'!=typeof j.id){a.next=7;break}throw new Error(k+' requires an ID for the '+d+' type');case 7:for(g in'POST'!==k&&(e.id=j.id.toString()),f=function(a){if(null!==j[a]&&j[a].constructor===Object){if('string'==typeof j[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof j[a].type&&(j[a].type=i.plural(i.camel(a))),e.relationships[a]={data:Object.assign(j[a])};else throw new Error(k+' requires an ID for the '+a+' relationships');}else if(null!==j[a]&&Array.isArray(j[a])){var b=i.plural(i.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:j[a].map(function(c){if('undefined'==typeof c.id)throw new Error(k+' requires an ID for the '+a+' relationships');return{id:c.id,type:c.type||b}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=j[a])},j)f(g);return a.abrupt('return',{data:e});case 13:throw a.prev=13,a.t0=a['catch'](0),h(a.t0);case 16:case'end':return a.stop();}},b,this,[[0,13]])}));return function(){return b.apply(this,arguments)}}(),s=function(a){return a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,function(a){return a.slice(1).toUpperCase()})},t=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'-'+a.toLowerCase()})},u=function(a){return a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(a){return'_'+a.toLowerCase()})},v=function(){function b(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e(this,b),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?function(a){return a}:s,this.resCase='none'===a.resourceCase?function(a){return a}:'snake'===a.resourceCase?u:t,this.plural=!1===a.pluralize?function(a){return a}:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=g.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}return f(b,[{key:'get',value:function(){var b=c(a.mark(function b(c){var e,f,g,j,k,m,n,o,p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},q=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=c.split('/'),f=d(e,3),g=f[0],j=f[1],k=f[2],m=this.plural(this.resCase(g)),j&&(m+='/'+j),k&&(m+='/'+this.resCase(k)),a.next=7,this.axios.get(m,{params:p,paramsSerializer:function(a){return i(a)},headers:Object.assign(this.headers,q)});case 7:return n=a.sent,o=n.data,a.abrupt('return',l(o));case 12:throw a.prev=12,a.t0=a['catch'](0),h(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'patch',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i,j=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,r.apply(this,[c,d,'PATCH']);case 3:return e=a.sent,f=this.plural(this.resCase(c))+'/'+d.id,a.next=7,this.axios.patch(f,e,{headers:Object.assign(this.headers,j)});case 7:return g=a.sent,i=g.data,a.abrupt('return',i);case 12:throw a.prev=12,a.t0=a['catch'](0),h(a.t0);case 15:case'end':return a.stop();}},b,this,[[0,12]])}));return function(){return b.apply(this,arguments)}}()},{key:'post',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c)),a.t0=this.axios,a.t1=e,a.next=6,r.apply(this,[c,d]);case 6:return a.t2=a.sent,a.t3={headers:Object.assign(this.headers,i)},a.next=10,a.t0.post.call(a.t0,a.t1,a.t2,a.t3);case 10:return f=a.sent,g=f.data,a.abrupt('return',g);case 15:throw a.prev=15,a.t4=a['catch'](0),h(a.t4);case 18:case'end':return a.stop();}},b,this,[[0,15]])}));return function(){return b.apply(this,arguments)}}()},{key:'remove',value:function(){var b=c(a.mark(function b(c,d){var e,f,g,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=this.plural(this.resCase(c))+'/'+d,a.t0=this.axios,a.t1=e,a.next=6,r.apply(this,[c,{id:d},'DELETE']);case 6:return a.t2=a.sent,a.t3=Object.assign(this.headers,i),a.t4={data:a.t2,headers:a.t3},a.next=11,a.t0.delete.call(a.t0,a.t1,a.t4);case 11:return f=a.sent,g=f.data,a.abrupt('return',g);case 16:throw a.prev=16,a.t5=a['catch'](0),h(a.t5);case 19:case'end':return a.stop();}},b,this,[[0,16]])}));return function(){return b.apply(this,arguments)}}()},{key:'self',value:function(){var b=c(a.mark(function b(){var c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.get('users',Object.assign({filter:{self:!0}},d),e);case 3:return c=a.sent,a.abrupt('return',c.data[0]);case 7:throw a.prev=7,a.t0=a['catch'](0),h(a.t0);case 10:case'end':return a.stop();}},b,this,[[0,7]])}));return function(){return b.apply(this,arguments)}}()},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),b}();return v});
//# sourceMappingURL=legacy.js.map

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

(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','axios'],b):a.Kitsu=b(a._asyncToGenerator,a._slicedToArray,a.axios)})(this,function(a,b,c){'use strict';function d(a){if(a.response){const b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function e(a){let b='';for(let c in a)'object'==typeof a[c]?Object.keys(a[c]).forEach((d)=>{b+=`&${c}[${d}]=${a[c][d]}`}):b+=`&${c}=${a[c]}`;return a?b.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c;let f=(()=>{var b=a(function*(b){return'object'==typeof b&&null!==b&&(Array.isArray(b)?yield b.map((()=>{var b=a(function*(a){return f(a)});return function(){return b.apply(this,arguments)}})()):b.attributes&&b.attributes.constructor===Object&&(Object.keys(b.attributes).forEach(function(a){b[a]=b.attributes[a]}),delete b.attributes)),b});return function(){return b.apply(this,arguments)}})(),g=(()=>{var b=a(function*(a){var b,c=!0,d=!1;try{for(var e,g=(yield a.data)[Symbol.iterator]();!(c=(e=g.next()).done);c=!0){let b=e.value;a.included&&(b=yield m(b,a.included)),b.attributes&&(b=yield f(b)),a.data[a.data.indexOf(b)]=b}}catch(a){d=!0,b=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw b}}return a});return function(){return b.apply(this,arguments)}})(),h=(()=>{var b=a(function*(a){return a.data&&a.data.constructor===Array?a=yield g(a):a.included&&(a.data=yield m(a.data,a.included)),delete a.included,a.data.attributes&&(a.data=yield f(a.data)),a});return function(){return b.apply(this,arguments)}})(),i=(()=>{var b=a(function*(a,{id:b,type:c}){try{return a.filter(function(a){return a.id===b&&a.type===c})[0]||{id:b,type:c}}catch(a){d(a)}});return function(){return b.apply(this,arguments)}})(),j=(()=>{var b=a(function*(a,b,c){const d=yield i(c,{id:a,type:b});return d.relationships&&(yield m(d,c)),f(d)});return function(){return b.apply(this,arguments)}})(),k=(()=>{var b=a(function*(a,b,c){a[c]=[];var d,e=!0,f=!1;try{for(var g,h=(yield a.relationships[c].data)[Symbol.iterator]();!(e=(g=h.next()).done);e=!0){let d=g.value,e=d.id,f=d.type;a[c].push((yield j(e,f,b)))}}catch(a){f=!0,d=a}finally{try{!e&&h.return&&h.return()}finally{if(f)throw d}}});return function(){return b.apply(this,arguments)}})(),l=(()=>{var b=a(function*(a,b,c){var d=a.relationships[c].data;const e=d.id,f=d.type;a[c]=yield j(e,f,b),delete a[c].relationships});return function(){return b.apply(this,arguments)}})(),m=(()=>{var b=a(function*(a,b){const c=a.relationships;let d=!1;for(let e in yield c)c[e].data&&Array.isArray(c[e].data)?(yield k(a,b,e),d=!0):c[e].data&&(yield l(a,b,e),d=!0);return d&&delete a.relationships,a});return function(){return b.apply(this,arguments)}})(),n=(()=>{var b=a(function*(a,b={},c='POST'){try{if(b.constructor!==Object||0===Object.keys(b).length)throw new Error(`${c} requires a JSON object body`);const d=this.plural(this.camel(a)),e={type:d};if('POST'!==c&&'undefined'==typeof b.id)throw new Error(`${c} requires an ID for the ${d} type`);for(let a in'POST'!==c&&(e.id=b.id.toString()),b)if(null!==b[a]&&b[a].constructor===Object){if('string'==typeof b[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof b[a].type&&(b[a].type=this.plural(this.camel(a))),e.relationships[a]={data:Object.assign(b[a])};else throw new Error(`${c} requires an ID for the ${a} relationships`);}else if(null!==b[a]&&Array.isArray(b[a])){const d=this.plural(this.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:b[a].map(function(b){if('undefined'==typeof b.id)throw new Error(`${c} requires an ID for the ${a} relationships`);return{id:b.id,type:b.type||d}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=b[a]);return{data:e}}catch(a){throw d(a)}});return function(){return b.apply(this,arguments)}})();var o=(a)=>a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,(a)=>a.slice(1).toUpperCase()),p=(a)=>a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(a)=>'-'+a.toLowerCase()),q=(a)=>a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(a)=>'_'+a.toLowerCase());class r{constructor(a={}){this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?(a)=>a:o,this.resCase='none'===a.resourceCase?(a)=>a:'snake'===a.resourceCase?q:p,this.plural=!1===a.pluralize?(a)=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=c.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get isAuth(){return!!this.headers.Authorization}get(c,f={},g={}){var i=this;return a(function*(){try{var a=c.split('/'),j=b(a,3);let d=j[0],l=j[1],m=j[2],n=i.plural(i.resCase(d));l&&(n+=`/${l}`),m&&(n+=`/${i.resCase(m)}`);var k=yield i.axios.get(n,{params:f,paramsSerializer:function(a){return e(a)},headers:Object.assign(i.headers,g)});const o=k.data;return h(o)}catch(a){throw d(a)}})()}patch(b,c,e={}){var f=this;return a(function*(){try{const d=yield n.apply(f,[b,c,'PATCH']),g=f.plural(f.resCase(b))+'/'+c.id;var a=yield f.axios.patch(g,d,{headers:Object.assign(f.headers,e)});const h=a.data;return h}catch(a){throw d(a)}})()}post(b,c,e={}){var f=this;return a(function*(){try{const d=f.plural(f.resCase(b));var a=yield f.axios.post(d,(yield n.apply(f,[b,c])),{headers:Object.assign(f.headers,e)});const g=a.data;return g}catch(a){throw d(a)}})()}remove(b,c,e={}){var f=this;return a(function*(){try{const d=f.plural(f.resCase(b))+'/'+c;var a=yield f.axios.delete(d,{data:yield n.apply(f,[b,{id:c},'DELETE']),headers:Object.assign(f.headers,e)});const g=a.data;return g}catch(a){throw d(a)}})()}self(b={},c={}){var e=this;return a(function*(){try{const a=yield e.get('users',Object.assign({filter:{self:!0}},b),c);return a.data[0]}catch(a){throw d(a)}})()}}return r});
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/helpers/asyncToGenerator'),require('babel-runtime/helpers/slicedToArray'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/helpers/asyncToGenerator','babel-runtime/helpers/slicedToArray','axios'],b):a.Kitsu=b(a._asyncToGenerator,a._slicedToArray,a.axios)})(this,function(a,b,c){'use strict';function d(a){if(a.response){const b=a.response.data;b&&b.errors&&(a.errors=b.errors)}throw a}function e(a){let b='';for(let c in a)'object'==typeof a[c]?Object.keys(a[c]).forEach((d)=>{b+=`&${c}[${d}]=${a[c][d]}`}):b+=`&${c}=${a[c]}`;return a?b.slice(1):''}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c;let f=(()=>{var b=a(function*(b){return'object'==typeof b&&null!==b&&(Array.isArray(b)?yield b.map((()=>{var b=a(function*(a){return f(a)});return function(){return b.apply(this,arguments)}})()):b.attributes&&b.attributes.constructor===Object&&(Object.keys(b.attributes).forEach(function(a){b[a]=b.attributes[a]}),delete b.attributes)),b});return function(){return b.apply(this,arguments)}})(),g=(()=>{var b=a(function*(a){var b,c=!0,d=!1;try{for(var e,g=(yield a.data)[Symbol.iterator]();!(c=(e=g.next()).done);c=!0){let b=e.value;a.included&&(b=yield m(b,a.included)),b.attributes&&(b=yield f(b)),a.data[a.data.indexOf(b)]=b}}catch(a){d=!0,b=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw b}}return a});return function(){return b.apply(this,arguments)}})(),h=(()=>{var b=a(function*(a){return a.data&&a.data.constructor===Array?a=yield g(a):a.included&&(a.data=yield m(a.data,a.included)),delete a.included,a.data.attributes&&(a.data=yield f(a.data)),a});return function(){return b.apply(this,arguments)}})(),i=(()=>{var b=a(function*(a,{id:b,type:c}){try{const d=a.filter(function(a){return a.id===b&&a.type===c})[0]||{id:b,type:c};return Object.assign({},d)}catch(a){d(a)}});return function(){return b.apply(this,arguments)}})(),j=(()=>{var b=a(function*({id:a,type:b,meta:c},d){const e=yield i(d,{id:a,type:b});return e.relationships&&(yield m(e,d)),c&&(e.meta=c),f(e)});return function(){return b.apply(this,arguments)}})(),k=(()=>{var b=a(function*(a,b,c){a[c]=[];var d,e=!0,f=!1;try{for(var g,h=(yield a.relationships[c].data)[Symbol.iterator]();!(e=(g=h.next()).done);e=!0){let d=g.value;a[c].push((yield j(d,b)))}}catch(a){f=!0,d=a}finally{try{!e&&h.return&&h.return()}finally{if(f)throw d}}});return function(){return b.apply(this,arguments)}})(),l=(()=>{var b=a(function*(a,b,c){a[c]=yield j(a.relationships[c].data,b),delete a[c].relationships});return function(){return b.apply(this,arguments)}})(),m=(()=>{var b=a(function*(a,b){const c=a.relationships;let d=!1;for(let e in yield c)c[e].data&&Array.isArray(c[e].data)?(yield k(a,b,e),d=!0):c[e].data&&(yield l(a,b,e),d=!0);return d&&delete a.relationships,a});return function(){return b.apply(this,arguments)}})(),n=(()=>{var b=a(function*(a,b={},c='POST'){try{if(b.constructor!==Object||0===Object.keys(b).length)throw new Error(`${c} requires a JSON object body`);const d=this.plural(this.camel(a)),e={type:d};if('POST'!==c&&'undefined'==typeof b.id)throw new Error(`${c} requires an ID for the ${d} type`);for(let a in'POST'!==c&&(e.id=b.id.toString()),b)if(null!==b[a]&&b[a].constructor===Object){if('string'==typeof b[a].id)'undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof b[a].type&&(b[a].type=this.plural(this.camel(a))),e.relationships[a]={data:Object.assign(b[a])};else throw new Error(`${c} requires an ID for the ${a} relationships`);}else if(null!==b[a]&&Array.isArray(b[a])){const d=this.plural(this.camel(a));'undefined'==typeof e.relationships&&(e.relationships={}),e.relationships[a]={data:b[a].map(function(b){if('undefined'==typeof b.id)throw new Error(`${c} requires an ID for the ${a} relationships`);return{id:b.id,type:b.type||d}})}}else'id'!==a&&'type'!==a&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[a]=b[a]);return{data:e}}catch(a){throw d(a)}});return function(){return b.apply(this,arguments)}})();var o=(a)=>a.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,(a)=>a.slice(1).toUpperCase()),p=(a)=>a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(a)=>'-'+a.toLowerCase()),q=(a)=>a.charAt(0).toLowerCase()+a.slice(1).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(a)=>'_'+a.toLowerCase());class r{constructor(a={}){this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===a.camelCaseTypes?(a)=>a:o,this.resCase='none'===a.resourceCase?(a)=>a:'snake'===a.resourceCase?q:p,this.plural=!1===a.pluralize?(a)=>a:require('pluralize'),this.headers=Object.assign({},a.headers,{Accept:'application/vnd.api+json',"Content-Type":'application/vnd.api+json'}),this.axios=c.create({baseURL:a.baseURL||'https://kitsu.io/api/edge',timeout:a.timeout||3e4})}get isAuth(){return!!this.headers.Authorization}get(c,f={},g={}){var i=this;return a(function*(){try{var a=c.split('/'),j=b(a,3);let d=j[0],l=j[1],m=j[2],n=i.plural(i.resCase(d));l&&(n+=`/${l}`),m&&(n+=`/${i.resCase(m)}`);var k=yield i.axios.get(n,{params:f,paramsSerializer:function(a){return e(a)},headers:Object.assign(i.headers,g)});const o=k.data;return h(o)}catch(a){throw d(a)}})()}patch(b,c,e={}){var f=this;return a(function*(){try{const d=yield n.apply(f,[b,c,'PATCH']),g=f.plural(f.resCase(b))+'/'+c.id;var a=yield f.axios.patch(g,d,{headers:Object.assign(f.headers,e)});const h=a.data;return h}catch(a){throw d(a)}})()}post(b,c,e={}){var f=this;return a(function*(){try{const d=f.plural(f.resCase(b));var a=yield f.axios.post(d,(yield n.apply(f,[b,c])),{headers:Object.assign(f.headers,e)});const g=a.data;return g}catch(a){throw d(a)}})()}remove(b,c,e={}){var f=this;return a(function*(){try{const d=f.plural(f.resCase(b))+'/'+c;var a=yield f.axios.delete(d,{data:yield n.apply(f,[b,{id:c},'DELETE']),headers:Object.assign(f.headers,e)});const g=a.data;return g}catch(a){throw d(a)}})()}self(b={},c={}){var e=this;return a(function*(){try{const a=yield e.get('users',Object.assign({filter:{self:!0}},b),c);return a.data[0]}catch(a){throw d(a)}})()}}return r});
//# sourceMappingURL=node.js.map
{
"name": "kitsu",
"version": "4.5.3",
"version": "4.6.0",
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs",

@@ -93,3 +93,3 @@ "license": "MIT",

"cross-env": "~5.1.0",
"documentation": "~5.3.3",
"documentation": "~5.4.0",
"eslint": "~4.17.0",

@@ -96,0 +96,0 @@ "eslint-config-wopian": "~1.1.0",

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

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