add subStops & entrances options

This commit is contained in:
Jannis R 2020-03-18 20:04:39 +01:00
parent d98910a651
commit 07c77f8cf9
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
10 changed files with 39 additions and 3 deletions

View file

@ -28,6 +28,8 @@ With `opt`, you can override the default options, which look like this:
direction: null, // only show departures heading to this station direction: null, // only show departures heading to this station
duration: 10, // show departures for the next n minutes duration: 10, // show departures for the next n minutes
results: null, // max. number of results; `null` means "whatever HAFAS wants" results: null, // max. number of results; `null` means "whatever HAFAS wants"
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false, // parse & expose lines at the stop/station? linesOfStops: false, // parse & expose lines at the stop/station?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
stopovers: false, // fetch & parse previous/next stopovers? stopovers: false, // fetch & parse previous/next stopovers?

View file

@ -70,6 +70,8 @@ With `opt`, you can override the default options, which look like this:
}, },
tickets: false, // return tickets? only available with some profiles tickets: false, // return tickets? only available with some profiles
polylines: false, // return a shape for each leg? polylines: false, // return a shape for each leg?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
scheduledDays: false, // parse which days each journey is valid on scheduledDays: false, // parse which days each journey is valid on
language: 'en', // language to get results in language: 'en', // language to get results in

View file

@ -11,6 +11,8 @@ With `opt`, you can override the default options, which look like this:
, stops: true // return stops/stations? , stops: true // return stops/stations?
, addresses: true , addresses: true
, poi: true // points of interest , poi: true // points of interest
, subStops: true // parse & expose sub-stops of stations?
, entrances: true // parse & expose entrances of stops/stations?
, linesOfStops: false // parse & expose lines at each stop/station? , linesOfStops: false // parse & expose lines at each stop/station?
, language: 'en' // language to get results in , language: 'en' // language to get results in
} }

View file

@ -12,6 +12,8 @@ With `opt`, you can override the default options, which look like this:
distance: null, // maximum walking distance in meters distance: null, // maximum walking distance in meters
poi: false, // return points of interest? poi: false, // return points of interest?
stops: true, // return stops/stations? stops: true, // return stops/stations?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false, // parse & expose lines at each stop/station? linesOfStops: false, // parse & expose lines at each stop/station?
language: 'en' // language to get results in language: 'en' // language to get results in
} }

View file

@ -12,6 +12,8 @@ With `opt`, you can override the default options, which look like this:
duration: 30, // compute frames for the next n seconds duration: 30, // compute frames for the next n seconds
frames: 3, // nr of frames to compute frames: 3, // nr of frames to compute
polylines: true, // return a track shape for each vehicle? polylines: true, // return a track shape for each vehicle?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
language: 'en' // language to get results in language: 'en' // language to get results in
} }
``` ```

View file

@ -18,7 +18,9 @@ With `opt`, you can override the default options, which look like this:
suburban: true, suburban: true,
subway: true subway: true
// … // …
} },
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
} }
``` ```

View file

@ -9,6 +9,8 @@ With `opt`, you can override the default options, which look like this:
stopovers: false, // return stations on the way? stopovers: false, // return stations on the way?
polylines: false, // return a shape for each leg? polylines: false, // return a shape for each leg?
tickets: false, // return tickets? only available with some profiles tickets: false, // return tickets? only available with some profiles
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
language: 'en' // language to get results in language: 'en' // language to get results in
} }

View file

@ -23,6 +23,8 @@ With `opt`, you can override the default options, which look like this:
```js ```js
{ {
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false, // parse & expose lines at the stop/station? linesOfStops: false, // parse & expose lines at the stop/station?
language: 'en' // language to get results in language: 'en' // language to get results in
} }

View file

@ -28,6 +28,8 @@ With `opt`, you can override the default options, which look like this:
{ {
stopovers: true, // return stations on the way? stopovers: true, // return stations on the way?
polyline: false, // return a shape for the trip? polyline: false, // return a shape for the trip?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
language: 'en' // language to get results in language: 'en' // language to get results in
} }

View file

@ -53,6 +53,8 @@ const createClient = (profile, userAgent, opt = {}) => {
direction: null, // only show departures stopping by this station direction: null, // only show departures stopping by this station
duration: 10, // show departures for the next n minutes duration: 10, // show departures for the next n minutes
results: null, // max. number of results; `null` means "whatever HAFAS wants" results: null, // max. number of results; `null` means "whatever HAFAS wants"
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false, // parse & expose lines at the stop/station? linesOfStops: false, // parse & expose lines at the stop/station?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
stopovers: false, // fetch & parse previous/next stopovers? stopovers: false, // fetch & parse previous/next stopovers?
@ -126,6 +128,8 @@ const createClient = (profile, userAgent, opt = {}) => {
startWithWalking: true, startWithWalking: true,
tickets: false, // return tickets? tickets: false, // return tickets?
polylines: false, // return leg shapes? polylines: false, // return leg shapes?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
scheduledDays: false scheduledDays: false
}, opt) }, opt)
@ -249,6 +253,8 @@ const createClient = (profile, userAgent, opt = {}) => {
stopovers: false, // return stations on the way? stopovers: false, // return stations on the way?
tickets: false, // return tickets? tickets: false, // return tickets?
polylines: false, // return leg shapes? polylines: false, // return leg shapes?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true // parse & expose hints & warnings? remarks: true // parse & expose hints & warnings?
}, opt) }, opt)
@ -279,6 +285,8 @@ const createClient = (profile, userAgent, opt = {}) => {
stops: true, // return stops/stations? stops: true, // return stops/stations?
addresses: true, addresses: true,
poi: true, // points of interest poi: true, // points of interest
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false // parse & expose lines at each stop/station? linesOfStops: false // parse & expose lines at each stop/station?
}, opt) }, opt)
@ -300,6 +308,8 @@ const createClient = (profile, userAgent, opt = {}) => {
opt = Object.assign({ opt = Object.assign({
linesOfStops: false, // parse & expose lines at the stop/station? linesOfStops: false, // parse & expose lines at the stop/station?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
}, opt) }, opt)
@ -331,6 +341,8 @@ const createClient = (profile, userAgent, opt = {}) => {
distance: null, // maximum walking distance in meters distance: null, // maximum walking distance in meters
poi: false, // return points of interest? poi: false, // return points of interest?
stops: true, // return stops/stations? stops: true, // return stops/stations?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
linesOfStops: false // parse & expose lines at each stop/station? linesOfStops: false // parse & expose lines at each stop/station?
}, opt) }, opt)
@ -355,6 +367,8 @@ const createClient = (profile, userAgent, opt = {}) => {
opt = Object.assign({ opt = Object.assign({
stopovers: true, // return stations on the way? stopovers: true, // return stations on the way?
polyline: false, // return a track shape? polyline: false, // return a track shape?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true // parse & expose hints & warnings? remarks: true // parse & expose hints & warnings?
}, opt) }, opt)
@ -391,7 +405,9 @@ const createClient = (profile, userAgent, opt = {}) => {
// todo: what happens with `frames: 0`? // todo: what happens with `frames: 0`?
frames: 3, // nr of frames to compute frames: 3, // nr of frames to compute
products: null, // optionally an object of booleans products: null, // optionally an object of booleans
polylines: true // return a track shape for each vehicle? polylines: true, // return a track shape for each vehicle?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
}, opt || {}) }, opt || {})
opt.when = new Date(opt.when || Date.now()) opt.when = new Date(opt.when || Date.now())
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid') if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
@ -414,7 +430,9 @@ const createClient = (profile, userAgent, opt = {}) => {
when: Date.now(), when: Date.now(),
maxTransfers: 5, // maximum of 5 transfers maxTransfers: 5, // maximum of 5 transfers
maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite
products: {} products: {},
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
}, opt) }, opt)
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid') if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')