@2bad/ryanair
Advanced tools
Comparing version 2.0.2 to 3.0.0
@@ -1,6 +0,6 @@ | ||
export { getActive } from './getActive.js'; | ||
export { getClosest } from './getClosest.js'; | ||
export { getDestinations } from './getDestinations.js'; | ||
export { getInfo } from './getInfo.js'; | ||
export { searchByPhrase } from './searchByPhrase.js'; | ||
export { searchByRoute } from './searchByRoute.js'; | ||
export { getActive } from '../airports/getActive.js'; | ||
export { getClosest } from '../airports/getClosest.js'; | ||
export { getDestinations } from '../airports/getDestinations.js'; | ||
export { getInfo } from '../airports/getInfo.js'; | ||
export { searchByPhrase } from '../airports/searchByPhrase.js'; | ||
export { searchByRoute } from '../airports/searchByRoute.js'; |
@@ -1,6 +0,6 @@ | ||
export { getActive } from './getActive.js'; | ||
export { getClosest } from './getClosest.js'; | ||
export { getDestinations } from './getDestinations.js'; | ||
export { getInfo } from './getInfo.js'; | ||
export { searchByPhrase } from './searchByPhrase.js'; | ||
export { searchByRoute } from './searchByRoute.js'; | ||
export { getActive } from '../airports/getActive.js'; | ||
export { getClosest } from '../airports/getClosest.js'; | ||
export { getDestinations } from '../airports/getDestinations.js'; | ||
export { getInfo } from '../airports/getInfo.js'; | ||
export { searchByPhrase } from '../airports/searchByPhrase.js'; | ||
export { searchByRoute } from '../airports/searchByRoute.js'; |
@@ -5,4 +5,4 @@ /** | ||
* | ||
* @return A promise that resolves with the response data or rejects with an error | ||
* @returns A promise that resolves with the response data or rejects with an error | ||
*/ | ||
export declare const get: import("got").Got; |
@@ -7,3 +7,3 @@ import { got } from 'got'; | ||
* | ||
* @return A promise that resolves with the response data or rejects with an error | ||
* @returns A promise that resolves with the response data or rejects with an error | ||
*/ | ||
@@ -10,0 +10,0 @@ export const get = got.extend({ |
@@ -1,1 +0,2 @@ | ||
export { cheapestPerDay } from './cheapestPerDay.js'; | ||
export { getCheapestPerDay } from '../fares/getCheapestPerDay.js'; | ||
export { getDailyFaresInRange } from '../fares/getDailyFaresInRange.js'; |
@@ -1,1 +0,2 @@ | ||
export { cheapestPerDay } from './cheapestPerDay.js'; | ||
export { getCheapestPerDay } from '../fares/getCheapestPerDay.js'; | ||
export { getDailyFaresInRange } from '../fares/getDailyFaresInRange.js'; |
@@ -1,2 +0,2 @@ | ||
export { getAvailable } from './getAvailable.js'; | ||
export { getDates } from './getDates.js'; | ||
export { getAvailable } from '../flights/getAvailable.js'; | ||
export { getDates } from '../flights/getDates.js'; |
@@ -1,2 +0,2 @@ | ||
export { getAvailable } from './getAvailable.js'; | ||
export { getDates } from './getDates.js'; | ||
export { getAvailable } from '../flights/getAvailable.js'; | ||
export { getDates } from '../flights/getDates.js'; |
@@ -0,5 +1,16 @@ | ||
import { type StrDate } from '../date.types.js'; | ||
/** | ||
* Calculates the date for the next day in 'YYYY-MM-DD' format. | ||
* @returns {string} The formatted date for tomorrow. | ||
* Calculates the date for the next day (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export declare const tomorrow: () => string; | ||
/** | ||
* Calculates the date for the next month (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export declare const nextMonth: () => string; | ||
/** | ||
* Returns an array of the first day of each month in a given date range (formatted as 'YYYY-MM-01') | ||
* | ||
* @param startDate - The start date of the range (formatted as 'YYYY-MM-DD') | ||
* @param endDate - The end date of the range (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export declare const getFirstDayOfEachMonthInRange: (startDate: StrDate, endDate: StrDate) => StrDate[]; |
@@ -0,10 +1,29 @@ | ||
import { addDays, addMonths, eachMonthOfInterval, format } from 'date-fns'; | ||
/** | ||
* Calculates the date for the next day in 'YYYY-MM-DD' format. | ||
* @returns {string} The formatted date for tomorrow. | ||
* Calculates the date for the next day (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export const tomorrow = () => { | ||
const currentDate = new Date(); | ||
currentDate.setDate(currentDate.getDate() + 1); | ||
const tomorrowDate = addDays(currentDate, 1); | ||
// Format the date into 'YYYY-MM-DD' format | ||
return currentDate.toISOString().slice(0, 10); | ||
return format(tomorrowDate, 'yyyy-MM-dd'); | ||
}; | ||
/** | ||
* Calculates the date for the next month (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export const nextMonth = () => { | ||
const currentDate = new Date(); | ||
const nextMonthDate = addMonths(currentDate, 1); | ||
// Format the date into 'YYYY-MM-DD' format | ||
return format(nextMonthDate, 'yyyy-MM-dd'); | ||
}; | ||
/** | ||
* Returns an array of the first day of each month in a given date range (formatted as 'YYYY-MM-01') | ||
* | ||
* @param startDate - The start date of the range (formatted as 'YYYY-MM-DD') | ||
* @param endDate - The end date of the range (formatted as 'YYYY-MM-DD') | ||
*/ | ||
export const getFirstDayOfEachMonthInRange = (startDate, endDate) => { | ||
const dates = eachMonthOfInterval({ start: new Date(startDate), end: new Date(endDate) }); | ||
return dates.map((d) => format(d, 'yyyy-MM-01')); | ||
}; |
{ | ||
"name": "@2bad/ryanair", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "Unofficial typescript client for the Ryanair API that allows you to easily retrieve information about airports, flights and prices.", | ||
@@ -40,4 +40,4 @@ "keywords": [ | ||
"clean": "rimraf build", | ||
"compile": "tsc --project tsconfig.json", | ||
"fix-alias": "tsc-alias -p tsconfig.json", | ||
"compile": "tsc --project tsconfig.build.json", | ||
"fix-alias": "tsc-alias -p tsconfig.build.json", | ||
"format:check": "prettier --check source/**/*.ts", | ||
@@ -60,2 +60,3 @@ "format:fix": "prettier --write source/**/*.ts", | ||
"dependencies": { | ||
"date-fns": "2.30.0", | ||
"got": "12.6.0", | ||
@@ -69,5 +70,5 @@ "tough-cookie": "4.1.2", | ||
"@types/tough-cookie": "4.0.2", | ||
"@typescript-eslint/eslint-plugin": "5.59.5", | ||
"@typescript-eslint/parser": "5.59.5", | ||
"@vitest/coverage-c8": "0.31.0", | ||
"@typescript-eslint/eslint-plugin": "5.59.6", | ||
"@typescript-eslint/parser": "5.59.6", | ||
"@vitest/coverage-c8": "0.31.1", | ||
"eslint": "8.40.0", | ||
@@ -78,12 +79,13 @@ "eslint-config-prettier": "8.8.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-jsdoc": "44.2.4", | ||
"eslint-plugin-n": "15.7.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-promise": "6.1.1", | ||
"eslint-plugin-vitest": "0.2.2", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.8.8", | ||
"rimraf": "5.0.0", | ||
"ts-node": "10.9.1", | ||
"rimraf": "5.0.1", | ||
"tsc-alias": "1.8.6", | ||
"typescript": "5.0.4", | ||
"vitest": "0.31.0" | ||
"vitest": "0.31.1" | ||
}, | ||
@@ -90,0 +92,0 @@ "engines": { |
@@ -38,3 +38,3 @@ # Ryanair API | ||
// Or the cheapest one-way fares between two airports for a given start date | ||
const cheapest = await fares.cheapestPerDay('BER', 'DUB', '2023-10-10') | ||
const cheapest = await fares.getCheapestPerDay('BER', 'DUB', '2023-10-10') | ||
``` | ||
@@ -51,4 +51,5 @@ | ||
- [searchByRoute(from: string, to = '', locale = 'en-gb')](docs/airports.md#searchbyroutefrom-string-to---locale--en-gb) | ||
- [Fares](docs/fares.md#fares-api) | ||
- [cheapestPerDay(from: IataCode, to: IataCode, startDate: StrDate, currency = 'EUR')](docs/fares.md#cheapestperdayfrom-iatacode-to-iatacode-startdate-strdate-currency--eur) | ||
- [Fares](#fares-api) | ||
- [getCheapestPerDay(from: IataCode, to: IataCode, startDate: StrDate, currency = 'EUR')](#getcheapestperdayfrom-iatacode-to-iatacode-startdate-strdate-currency--eur) | ||
- [getDailyFaresInRange(from: IataCode, to: IataCode, startDate: StrDate, endDate: StrDate, currency = 'EUR')](#getdailyfaresinrangefrom-iatacode-to-iatacode-startdate-strdate-enddate-strdate-currency--eur) | ||
- [Flights](docs/flights.md#flights-api) | ||
@@ -58,2 +59,10 @@ - [getDates(from: IataCode, to: IataCode)](docs/flights.md#getdatesfrom-iatacode-to-iatacode) | ||
## IATA codes | ||
IATA codes are three-letter codes used by the International Air Transport Association (IATA) to identify airports, airlines, and other entities in the aviation industry. These codes are used primarily for ticketing, scheduling, and other administrative purposes. | ||
Airport codes are the most common type of IATA code. They consist of three letters, with the first two letters representing the country and the third letter representing the airport. For example, LAX is the IATA code for Los Angeles International Airport in the United States. | ||
For a full list of available IATA codes, please visit this [page](https://www.iata.org/en/publications/directories/code-search/). | ||
## Error handling | ||
@@ -60,0 +69,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76
103203
4
22
43
2966
+ Addeddate-fns@2.30.0
+ Added@babel/runtime@7.26.0(transitive)
+ Addeddate-fns@2.30.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)