bugfixes 🐛, expose part ID, 1.0.2

This commit is contained in:
Jannis R 2017-06-18 13:02:08 +02:00
parent b0399215cd
commit 412e1c551f
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 4 additions and 3 deletions

View file

@ -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>",

View file

@ -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
}