mirror of
https://github.com/holidayapi/holidayapi-node.git
synced 2025-06-21 12:36:33 +00:00
feat: add workday endpoint
Added support for our latest endpoint, which calculates the workday a given number of business days into the future from the given date for the given country. Also: * perf: updated dependencies * ci: pinned eslint to 7.2.x due to airbnb incompatibility with 7.3.x. * ci: tweaked / improved eslint rules a bit. * refactor: updated types to use `;` and include weekday response. * docs: added example for new endpoint.
This commit is contained in:
parent
07988d8c71
commit
2230488d14
10 changed files with 377 additions and 177 deletions
20
dist/holidayapi.js
vendored
20
dist/holidayapi.js
vendored
|
@ -132,6 +132,26 @@ var HolidayAPI = (function () {
|
|||
});
|
||||
});
|
||||
};
|
||||
HolidayAPI.prototype.workday = function (request) {
|
||||
if (request === void 0) { request = {}; }
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
if (!request.country) {
|
||||
throw new Error('Missing country');
|
||||
}
|
||||
else if (!request.start) {
|
||||
throw new Error('Missing start date');
|
||||
}
|
||||
else if (!request.days) {
|
||||
throw new Error('Missing days');
|
||||
}
|
||||
else if (request.days < 1) {
|
||||
throw new Error('Days must be 1 or more');
|
||||
}
|
||||
return [2, this.request('workday', request)];
|
||||
});
|
||||
});
|
||||
};
|
||||
return HolidayAPI;
|
||||
}());
|
||||
exports.HolidayAPI = HolidayAPI;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue