class Controller extends Analyzer
Provides methods to analyze the given data.
- new Controller(): Controller
No description.
Default payload that has been preprocessed in minor ways, e.g. by sorting by the given sort order and parsing contained JSON strings.
When working with this data, you should clone it.
The simple format of the given data. Is updated whenever the underlying
tripis changed through a builtin method.When working with this data, you should clone it, as is done in all data analysis methods of this class.
- payload: object
The raw, untouched payload that has been extracted from Interrail.
- rebuildSimpleTrip(): void
No description.
- getAllTrains(): Train[]
No description.
- getAllStops(): Station[]
No description.
- getJourneyStations(): Record<string, Station>
No description.
- getTrainStations(): Record<string, Station>
No description.
No description.
No description.
- mergeJourneys(...journeys: Journey[]): Trip
Merge arbitrarily many journeys into the first specified journey in sequential order. The given source journeys will be deleted and no overlapping, non-mergable data will be preserved for these.
Operates directly on
tripwithout cloning, as well as on all of the specified journeys. If you need to reuse any of them, be sure to pass deep copies.You can use
getJourneysOfADateto easily filter journeys to pass into this method.- getJourneysOfADate(date: Date | Partial<InterrailDate>): Journey[]
Return a subset of all journeys that matches a specific (partial) date with precision up to a whole day.
When passing a
Date, the year, month and day must match exactly.When passing a
InterrailDateformat, any field may be omitted in order to filter more roughly, e.g. all journeys that happened on the third of a month, or all journeys in september of 2024.- static mergeTimes(...times: InterrailTime[]): InterrailTime
No description.
- static resolveDepartureAndArrival(baseDate: InterrailDate,): { departureTime: Date, arrivalTime: Date }
departure: InterrailTime,
arrival: InterrailTime No description.
class Analyzer
Provides methods to analyze the given data.
Default payload that has been preprocessed in minor ways, e.g. by sorting by the given sort order and parsing contained JSON strings.
When working with this data, you should clone it.
The simple format of the given data. Is updated whenever the underlying
tripis changed through a builtin method.When working with this data, you should clone it, as is done in all data analysis methods of this class.
- rebuildSimpleTrip(): void
No description.
- getAllTrains(): Train[]
No description.
- getAllStops(): Station[]
No description.
- getJourneyStations(): Record<string, Station>
No description.
- getTrainStations(): Record<string, Station>
No description.
No description.
No description.
class RailDate
- isDuration: boolean
No description.
- get offset: number
No description.
- addDays(offset: number): void
No description.
- toString(): string
No description.
- static from(date: InterrailDate,): RailDate
...times: InterrailTime[] - static from(...times: InterrailTime[]): RailDate
No description.
- static getDayDiff(date1: RailDate, date2: RailDate): number
No description.
class SimpleFormat
Entirely static class that builds a simplified Interrail data format
from a given payload preprocessed by InterrailDataProcessor.
- new SimpleFormat(): SimpleFormat
No description.
- static getTimeInTrains(trains: Train[]): Date
No description.
- static getTrainsInterchangeDuration(trains: Train[]): Date
No description.
namespace Custom
interface Station implements Station
A single station.
namespace Default
interface Trip
interface InterrailTime
interface InterrailDate
interface Coordinates
group <Miscellaneous>
- type Journey:
No description.
- type Train:
No description.
- type StationExtraInfo: ArrivalDepartureInfo & { index: number }
No description.
namespace Simple
interface Trip
A trip that contains multiple journeys over arbitrarily many days.
interface Journey extends DepartureArrival
A journey from one station to another which may contain multiple individual trains and changeovers.
- from: string
Starting station.
- to: string
Ending station.
Total journey duration. This is the sum of the travel duration of all the journey's trains plus the changeover waiting times, thus the sum of
trainDurationandchangeDuration.Total time spent in trains on this journey.
Total time spent in between trains on this journey.
No description.
No description.
interface Train extends DepartureArrival
A single boarded train.
interface Station extends Partial<DepartureArrival>
A single station.
interface Options
- name: string
Custom name that the data should assume.