add journeysOutFrwd profile flag

This commit is contained in:
Jannis R 2019-12-29 22:16:45 +01:00
parent 00b184df36
commit ed0c606db1
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
3 changed files with 6 additions and 1 deletions

View file

@ -164,6 +164,9 @@ const createClient = (profile, userAgent, request = _request) => {
when = new Date(opt.departure) when = new Date(opt.departure)
if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid') if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid')
} else if (opt.arrival !== undefined && opt.arrival !== null) { } else if (opt.arrival !== undefined && opt.arrival !== null) {
if (!profile.journeysOutFrwd) {
throw new Error('opt.arrival is unsupported')
}
when = new Date(opt.arrival) when = new Date(opt.arrival)
if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid') if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid')
outFrwd = false outFrwd = false
@ -201,7 +204,6 @@ const createClient = (profile, userAgent, request = _request) => {
arrLocL: [to], arrLocL: [to],
jnyFltrL: filters, jnyFltrL: filters,
getTariff: !!opt.tickets, getTariff: !!opt.tickets,
outFrwd,
// todo: this is actually "take additional stations nearby the given start and destination station into account" // todo: this is actually "take additional stations nearby the given start and destination station into account"
// see rest.exe docs // see rest.exe docs
ushrp: !!opt.startWithWalking, ushrp: !!opt.startWithWalking,
@ -212,6 +214,7 @@ const createClient = (profile, userAgent, request = _request) => {
getPolyline: !!opt.polylines getPolyline: !!opt.polylines
} }
if (profile.journeysNumF) query.numF = opt.results if (profile.journeysNumF) query.numF = opt.results
if (profile.journeysOutFrwd) query.outFrwd = outFrwd
return request(profile, userAgent, opt, { return request(profile, userAgent, opt, {
cfg: {polyEnc: 'GPA'}, cfg: {polyEnc: 'GPA'},

View file

@ -66,6 +66,7 @@ const defaultProfile = {
filters, filters,
journeysNumF: true, // `journeys()` method: support for `numF` field? journeysNumF: true, // `journeys()` method: support for `numF` field?
journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field? departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field?
departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field? departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field?
trip: false, trip: false,

View file

@ -95,6 +95,7 @@ const dbBusradarNrwProfile = {
products: products, products: products,
journeysOutFrwd: false,
trip: true, trip: true,
radar: true radar: true
} }