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

holidayapi

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

holidayapi - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

71

.eslintrc.json
{
"env": {
"browser": true,
"es6": true,
"jest/globals": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:import/typescript"
"env": {
"es6": true,
"jest/globals": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:import/typescript"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest"
],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"import/extensions": [
"error",
"always",
{
"ts": "never",
"tsx": "never"
}
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest"
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": ["**/*.test.ts"]
}
],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": ["**/*.test.ts"] }
],
"import/prefer-default-export": "off",
"lines-between-class-members": "off",
"no-unused-vars": "off"
}
"import/prefer-default-export": "off",
"lines-between-class-members": "off",
"no-unused-vars": "off"
}
}

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

import { CountriesResponse, HolidaysResponse, HolidaysRequest, LanguagesResponse, Request } from './types';
import { CountriesRequest, CountriesResponse, HolidaysResponse, HolidaysRequest, LanguagesRequest, LanguagesResponse } from './types';
export declare class HolidayAPI {

@@ -11,5 +11,5 @@ baseUrl: string;

private request;
countries(request?: Request): Promise<CountriesResponse>;
countries(request?: CountriesRequest): Promise<CountriesResponse>;
holidays(request?: HolidaysRequest): Promise<HolidaysResponse>;
languages(request?: Request): Promise<LanguagesResponse>;
languages(request?: LanguagesRequest): Promise<LanguagesResponse>;
}
export declare type Endpoint = 'countries' | 'holidays' | 'languages';
export declare type Request = {
declare type Request = {
format?: 'csv' | 'json' | 'php' | 'tsv' | 'yaml' | 'xml';

@@ -8,3 +8,6 @@ key?: string;

};
export declare type Requests = Request | HolidaysRequest;
export declare type Requests = CountriesRequest | HolidaysRequest | LanguagesRequest;
export declare type CountriesRequest = Request & {
country?: string;
};
export declare type HolidaysRequest = Request & {

@@ -21,2 +24,5 @@ country?: string;

};
export declare type LanguagesRequest = Request & {
language?: string;
};
export declare type Response = {

@@ -67,1 +73,2 @@ requests: {

};
export {};
{
"name": "holidayapi",
"version": "3.0.0",
"version": "3.1.0",
"description": "Official Node.js library for Holiday API",

@@ -27,17 +27,17 @@ "main": "dist/index.js",

"devDependencies": {
"@types/jest": "^24.0.22",
"@types/jest": "^25.1.2",
"@types/nock": "^11.1.0",
"@types/node": "^12.12.7",
"@types/node-fetch": "^2.5.3",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0",
"coveralls": "^3.0.7",
"eslint": "^6.6.0",
"@types/node": "^13.7.1",
"@types/node-fetch": "^2.5.4",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"coveralls": "^3.0.9",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.0.3",
"jest": "^24.9.0",
"nock": "^11.7.0",
"ts-jest": "^24.1.0",
"typescript": "^3.7.2"
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.7.0",
"jest": "^25.1.0",
"nock": "^11.8.2",
"ts-jest": "^25.2.0",
"typescript": "^3.7.5"
},

@@ -48,4 +48,6 @@ "dependencies": {

"scripts": {
"build": "tsc",
"lint": "eslint --ext .js,.ts src/ tests/",
"test": "jest --coverage --coverageReporters=text-lcov | coveralls"
}
}

@@ -106,6 +106,14 @@ # Holiday API Node.js Library

#### Search for a country by code or name
#### Fetch a supported country by code
```javascript
holidayApi.countries({
country: 'NO',
});
```
#### Search for countries by code or name
```javascript
holidayApi.countries({
search: 'united',

@@ -123,6 +131,14 @@ });

#### Search for a language by code or name
#### Fetch a supported language by code
```javascript
holidayApi.language({
language: 'es',
});
```
#### Search for languages by code or name
```javascript
holidayApi.language({
search: 'Chinese',

@@ -129,0 +145,0 @@ });

@@ -96,2 +96,43 @@ import * as nock from 'nock';

it('should return one country', async () => {
const expectedResponse = {
status: 200,
requests: {
used: 1000,
available: 9000,
resets: '2019-10-01 00:00:00',
},
countries: [
{
code: 'ST',
name: 'Sao Tome and Principe',
languages: ['pt'],
codes: {
'alpha-2': 'ST',
'alpha-3': 'STP',
numeric: 678,
},
flag: 'https://www.countryflags.io/ST/flat/64.png',
subdivisions: [
{
code: 'ST-P',
name: 'Príncipe',
languages: ['pt'],
},
{
code: 'ST-S',
name: 'São Tomé',
languages: ['pt'],
},
],
},
],
};
mockRequest.get(`${basePath}&country=ST`).reply(200, expectedResponse);
expect(await holidayapi.countries({
country: 'ST',
})).toStrictEqual(expectedResponse);
});
it('should search countries', async () => {

@@ -353,2 +394,24 @@ const expectedResponse = {

it('should return one language', async () => {
const expectedResponse = {
status: 200,
requests: {
used: 1000,
available: 9000,
resets: '2019-10-01 00:00:00',
},
languages: [
{
code: 'hi',
name: 'Hindi',
},
],
};
mockRequest.get(`${basePath}&language=hi`).reply(200, expectedResponse);
expect(await holidayapi.languages({
language: 'hi',
})).toStrictEqual(expectedResponse);
});
it('should search languages', async () => {

@@ -355,0 +418,0 @@ const expectedResponse = {

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