class Controller extends Analyzer

Provides methods to analyze the given data.

new Controller(
payload: Trip,
options?: Partial<Options>
): 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 trip is 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.

No description.

No description.

No description.

No description.

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 trip without 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 getJourneysOfADate to easily filter journeys to pass into this method.

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 InterrailDate format, 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.

No description.

static resolveDepartureAndArrival(
baseDate: InterrailDate,
departure: InterrailTime,
arrival: InterrailTime
): { departureTime: Date, arrivalTime: Date }

No description.

class Analyzer

Provides methods to analyze the given data.

new Analyzer(trip: Trip): Analyzer

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 trip is 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.

No description.

No description.

No description.

No description.

No description.

No description.

No description.

class RailDate

new RailDate(
date: number | Date,
durationMode: boolean = false
): RailDate

No description.

No description.

isDuration: boolean

No description.

set year: void

No description.

get year: number

No description.

set month: void

No description.

get month: number

No description.

set day: void

No description.

get day: number

No description.

set hours: void

No description.

get hours: number

No description.

set minutes: void

No description.

get minutes: number

No description.

get offset: number

No description.

addDays(offset: number): void

No description.

dayDiffTo(date: RailDate): number

No description.

toString(): string

No description.

static from(
date: InterrailDate,
...times: InterrailTime[]
): RailDate
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.

No description.

static getFormat(trip: Trip): Trip

No description.

static getTimeInTrains(trains: Train[]): Date

No description.

No description.

namespace Custom

interface Station implements Station

A single station.

visits: number

How often the stop was visited in the given context.

name: string

No description.

country: string

No description.

stationId: number

The station's ID in some internal API.

No description.

No description.

No description.

namespace Default

interface Trip

brand: string

No description.

name: string

The trip name

pass: boolean

Whether an Eurail/Interrail pass was used

version: number

No description.

No description.

interface InterrailTime

offset: number

Number of additional days passed since the base date.

hours: number

No description.

minutes: number

No description.

interface InterrailDate

month: number

No description.

day: number

No description.

year: number

No description.

interface Coordinates

latitude: number

No description.

longitute: number

No description.

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.

All travels associated with the trip.

name: string

The trip name.

Data format version.

interface Journey extends DepartureArrival

A journey from one station to another which may contain multiple individual trains and changeovers.

All trains boarded in the journey.

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 trainDuration and changeDuration.

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.

All stations the train stopped at during travel (so not all the line's stops).

Travel duration.

direction: string

Where the train was headed.

operator?: string

Meta information of the train's operator.

No description.

No description.

interface Station extends Partial<DepartureArrival>

A single station.

name: string

No description.

country: string

No description.

stationId: number

The station's ID in some internal API.

No description.

No description.

No description.

interface Options

name: string

Custom name that the data should assume.