diff --git a/package.json b/package.json index e64564af..4ff7e5ea 100644 --- a/package.json +++ b/package.json @@ -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 ", diff --git a/parse.js b/parse.js index 8910e428..2aa42c17 100644 --- a/parse.js +++ b/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 }