UNPKG

minotor

Version:

A lightweight client-side transit routing library.

29 lines (28 loc) 1.25 kB
export type FrequencyWindow = { /** Start time in minutes since midnight */ startTime: number; /** End time (exclusive) in minutes since midnight */ endTime: number; /** Headway in minutes */ headwayMins: number; }; /** * A map from a GTFS trip_id to the list of frequency windows that define * its repeated service pattern. */ export type FrequenciesMap = Map<string, FrequencyWindow[]>; /** * Parses the frequencies.txt file from a GTFS feed. * * In GTFS, a frequency entry indicates that a trip departs repeatedly at * a fixed headway between start_time and end_time. The stop times in * stop_times.txt for that trip serve only as a template – each stop's * time offset relative to the first stop is preserved, while the absolute * departure times are generated from the frequency windows. * * @param stream The readable stream containing the frequencies.txt data. * @param activeTripIds The set of active trip IDs to filter by. * Only frequency entries whose trip_id appears in this set are included. * @returns A map of trip IDs to their ordered list of frequency windows. */ export declare const parseFrequencies: (stream: NodeJS.ReadableStream, activeTripIds: Set<string>) => Promise<FrequenciesMap>;