UNPKG

11holidays

Version:

Global holidays API for public holidays, bank holidays and observances from 230+ countries

2 lines (1 loc) 2.29 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("axios")):"function"==typeof define&&define.amd?define(["axios"],e):(t||self).holidays=e(t.axios)}(this,function(t){function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=/*#__PURE__*/e(t);function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},r.apply(this,arguments)}var n=/*#__PURE__*/function(){function t(t){this.baseUrl="https://api.11holidays.com/v1",this.apiKey=void 0,this.apiKey=t}var e=t.prototype;return e.get=function(t,e){try{return Promise.resolve(i.default.get(""+this.baseUrl+t,{params:r({apiKey:this.apiKey},e)})).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.post=function(t,e,n){try{return Promise.resolve(i.default.post(""+this.baseUrl+t,e,{params:r({apiKey:this.apiKey},n)})).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.put=function(t,e,n){try{return Promise.resolve(i.default.put(""+this.baseUrl+t,e,{params:r({apiKey:this.apiKey},n)})).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},e.delete=function(t,e){try{return Promise.resolve(i.default.delete(""+this.baseUrl+t,{params:r({apiKey:this.apiKey},e)})).then(function(t){return t.data})}catch(t){return Promise.reject(t)}},t}(),o=/*#__PURE__*/function(){function t(t){this.api=void 0,this.api=t}var e=t.prototype;return e.list=function(t){void 0===t&&(t=void 0);try{return Promise.resolve(this.api.get("/holidays",t))}catch(t){return Promise.reject(t)}},e.get=function(t){try{return Promise.resolve(this.api.get("/holidays/"+t))}catch(t){return Promise.reject(t)}},t}(),s=/*#__PURE__*/function(){function t(t){this.api=void 0,this.api=t}var e=t.prototype;return e.list=function(t){void 0===t&&(t=void 0);try{return Promise.resolve(this.api.get("/countries",t))}catch(t){return Promise.reject(t)}},e.get=function(t){try{return Promise.resolve(this.api.get("/countries/"+t))}catch(t){return Promise.reject(t)}},t}();return function(t){this.api=void 0,this.holidays=void 0,this.countries=void 0,this.api=new n(t),this.holidays=new o(this.api),this.countries=new s(this.api)}});