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

@jbouduin/holidays-http

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jbouduin/holidays-http

This is a wrapper around `@jbouduin/holidays-lib`, using http calls (Axios) to fetch the configuration files.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@jbouduin/holidays

This is a wrapper around @jbouduin/holidays-lib, using http calls (Axios) to fetch the configuration files.

Usage

Using the default language (en):

// instantiate the wrapper
const holidays = new HolidaysHttp('https://jbouduin.github.io/holiday-site/', 'assets/holidays');
// retrieve the supported languages
const supportedLanguages = await holidays.getSupportedLanguages();
// retrieve retrieve the hierarchies
const hierarchies = await holidays.getHierarchyTree();
// retrieve the holidays in 2022 for a munich in bavaria in germany
const holidaysForMunich = await holidays.getHolidays('de/by/mu', 2022, false);
// retrieve the holidays in 2022 for bavaria in germany, including all local holidays
const holidaysForBavaria = await holidays.getHolidays('de/by', 2022, true);
// retrieve the holidays in 2022 for germany, leaving out all regional and local holidays
const holidaysForGermany = await holidays.getHolidays('de', 2022, false);

In order to retrieve the data in another language (e.g. German), use the language parameter when instantiating Holidays:

const holidays = new Holidays('https://jbouduin.github.io/holiday-site/', 'assets/holidays', 'de');

A sample implementation can be found here

Prerequisites

The implementation of the file provider expects a directory structure like this below the assetsroot on the host.

│   configurations.json
│   languages.json
├───configurations
│       ae.json
│       ...
│       za.json
└───translations
        hierarchy.de.json
        hierarchy.en.json
        hierarchy.fr.json
        hierarchy.json
        hierarchy.nl.json
        hierarchy.pt.json
        holiday.de.json
        holiday.en.json
        holiday.fr.json
        holiday.json
        holiday.nl.json
        holiday.pt.json
        holiday.sv.json

FAQs

Package last updated on 28 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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