mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
bugfixes 🐛, expose part ID, 1.0.2
This commit is contained in:
parent
b0399215cd
commit
412e1c551f
2 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "hafas-client",
|
||||
"description": "JavaScript client for HAFAS mobile APIs.",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"main": "index.js",
|
||||
"files": ["index.js", "parse.js", "stringify.js"],
|
||||
"author": "Jannis R <mail@jannisr.de>",
|
||||
|
|
5
parse.js
5
parse.js
|
@ -100,6 +100,7 @@ const part = (tz, s, ln, r, c) => (pt) => {
|
|||
|
||||
if (pt.type === 'WALK') result.mode = 'walking'
|
||||
else if (pt.type === 'JNY') {
|
||||
result.id = pt.jny.jid
|
||||
result.line = ln[parseInt(pt.jny.prodX)]
|
||||
result.direction = pt.jny.dirTxt // todo: parse this
|
||||
|
||||
|
@ -144,7 +145,7 @@ const journey = (tz, s, ln, r) => (c) => {
|
|||
// tz = timezone, s = stations, ln = lines, r = remarks
|
||||
const departure = (tz, s, ln, r) => (d) => {
|
||||
const result = {
|
||||
station: s[parseInt(d.stbStop.locX)]
|
||||
station: s[parseInt(d.stbStop.locX)]
|
||||
, when: dateTime(tz, d.date, d.stbStop.dTimeR || d.stbStop.dTimeS).format()
|
||||
, direction: d.dirTxt
|
||||
, line: ln[parseInt(d.prodX)]
|
||||
|
@ -155,7 +156,7 @@ const departure = (tz, s, ln, r) => (d) => {
|
|||
const realtime = dateTime(tz, d.date, d.stbStop.dTimeR)
|
||||
const planned = dateTime(tz, d.date, d.stbStop.dTimeS)
|
||||
result.delay = Math.round((realtime - planned) / 1000)
|
||||
}
|
||||
} else result.delay = null
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue