mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
arrivals/departures: parse & expose platforms ✨
This commit is contained in:
parent
eeb9ec2535
commit
d3815f80d7
3 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,7 @@ This version is not fully backwords-compatible. Check out [the migration guide](
|
||||||
- ac9819b `arrivals()` method – [docs](arrivals.md)
|
- ac9819b `arrivals()` method – [docs](arrivals.md)
|
||||||
- 21c273c `journeys()`/`journeyLeg()`: leg stopovers: parse & expose delays
|
- 21c273c `journeys()`/`journeyLeg()`: leg stopovers: parse & expose delays
|
||||||
- 021ae45 `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms
|
- 021ae45 `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms
|
||||||
|
- 84bce0c `arrivals()`/`departures()`: parse & expose platforms
|
||||||
- 85e0bdf `journeys()`: `startWithWalking` option with default `true`
|
- 85e0bdf `journeys()`: `startWithWalking` option with default `true`
|
||||||
|
|
||||||
### breaking changes 💥
|
### breaking changes 💥
|
||||||
|
|
|
@ -37,6 +37,13 @@ const createParseArrOrDep = (profile, opt, data, prefix) => {
|
||||||
res.delay = Math.round((realtime - planned) / 1000)
|
res.delay = Math.round((realtime - planned) / 1000)
|
||||||
} else res.delay = null
|
} else res.delay = null
|
||||||
|
|
||||||
|
// todo: DRY with parseStopover
|
||||||
|
// todo: DRY with parseJourneyLeg
|
||||||
|
const pR = d.stbStop[prefix + 'PlatfR']
|
||||||
|
const pP = d.stbStop[prefix + 'PlatfS']
|
||||||
|
res.platform = pR || pP || null
|
||||||
|
// todo: `formerScheduledPlatform`
|
||||||
|
|
||||||
// todo: DRY with parseStopover
|
// todo: DRY with parseStopover
|
||||||
// todo: DRY with parseJourneyLeg
|
// todo: DRY with parseJourneyLeg
|
||||||
if (d.stbStop[prefix + 'Cncl']) {
|
if (d.stbStop[prefix + 'Cncl']) {
|
||||||
|
|
|
@ -243,6 +243,12 @@ const createValidateArrivalOrDeparture = (cfg) => {
|
||||||
a.strictEqual(typeof dep.delay, 'number', msg)
|
a.strictEqual(typeof dep.delay, 'number', msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dep.platform !== null) {
|
||||||
|
const msg = name + '.platform must '
|
||||||
|
a.strictEqual(typeof dep.platform, 'string', msg + 'be a string')
|
||||||
|
a.ok(dep.platform, name + 'not be empty')
|
||||||
|
}
|
||||||
|
|
||||||
val.line(val, dep.line, name + '.line')
|
val.line(val, dep.line, name + '.line')
|
||||||
a.strictEqual(typeof dep.direction, 'string', name + '.direction must be a string')
|
a.strictEqual(typeof dep.direction, 'string', name + '.direction must be a string')
|
||||||
a.ok(dep.direction, name + '.direction must not be empty')
|
a.ok(dep.direction, name + '.direction must not be empty')
|
||||||
|
|
Loading…
Add table
Reference in a new issue