Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
holidayapi
Advanced tools
Official Node.js library for Holiday API providing quick and easy access to holiday information from applications written in server-side JavaScript.
Please note, version 2.x of this library is a full rewrite of the 1.x series in TypeScript. The interfacing to the library has been simplified and existing applications upgrading to 2.x will need to be updated.
Version 1.x Syntax (Old) | Version 2.x+ Syntax (New) |
---|---|
const HolidayAPI = require('node-holidayapi'); | import { HolidayAPI } from 'holidayapi'; |
const holidayApi = new HolidayAPI(key).v1; | const holidayApi = new HolidayAPI({ key }); |
holidayApi.holidays(params, (err, data) => {}); | holidayApi.holidays(params).then((data) => {}); |
Version 1.x of the library can still be found here.
Full documentation of the Holiday API endpoints is available here.
# NPM
npm install --save holidayapi
# Yarn
yarn add holidayapi
import { HolidayAPI } from 'holidayapi';
const key = 'Insert your API key here';
const holidayApi = new HolidayAPI({ key });
// Fetch supported countries and subdivisions
holidayApi.countries()
.then((countries) => { console.log(countries); })
.catch((err) => { console.error(err); });
// Fetch supported languages
holidayApi.languages()
.then((languages) => { console.log(languages); })
.catch((err) => { console.error(err); });
// Fetch holidays with minimum parameters
holidayApi.holidays({ country: 'US', year: 2019 })
.then((holidays) => { console.log(holidays); })
.catch((err) => { console.error(err); });
// Async? Await? No problem!
(async () => {
// Fetch supported countries and subdivisions
const countries = await holidayApi.countries();
// Fetch supported languages
const languages = await holidayApi.languages();
// Fetch holidays with minimum parameters
const holidays = await holidayApi.holidays({
country: 'US',
year: 2019,
});
})();
holidayApi.countries();
holidayApi.countries({
public: true,
});
holidayApi.countries({
country: 'NO',
});
holidayApi.countries({
search: 'united',
});
holidayApi.languages();
holidayApi.language({
language: 'es',
});
holidayApi.language({
search: 'Chinese',
});
holidayApi.holidays({
country: 'US',
year: 2019,
});
holidayApi.holidays({
country: 'US',
year: 2019,
month: 7,
});
holidayApi.holidays({
country: 'US',
year: 2019,
month: 7,
day: 4,
});
holidayApi.holidays({
country: 'US',
year: 2019,
month: 7,
day: 4,
upcoming: true,
});
holidayApi.holidays({
country: 'US',
year: 2019,
month: 7,
day: 4,
previous: true,
});
holidayApi.holidays({
country: 'US',
year: 2019,
public: true,
});
holidayApi.holidays({
country: 'GB-ENG',
year: 2019,
});
holidayApi.holidays({
country: 'US',
year: 2019,
subdivisions: true,
});
holidayApi.holidays({
country: 'US',
year: 2019,
search: 'New Year',
});
holidayApi.holidays({
country: 'US',
year: 2019,
language: 'zh', // Chinese (Simplified)
});
holidayApi.holidays({
country: 'US,GB,NZ',
year: 2019,
});
holidayApi.holidays({
country: ['US', 'GB', 'NZ'],
year: 2019,
});
FAQs
Official Node.js library for Holiday API
We found that holidayapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.