mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
bugfixes 🐛
This commit is contained in:
parent
2572b9a42d
commit
5f4509d89d
2 changed files with 5 additions and 4 deletions
6
index.js
6
index.js
|
@ -34,9 +34,9 @@ const request = (opt) => {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const b = res.body
|
const b = res.body
|
||||||
|
|
||||||
if (b.err) return new Error(b.err)
|
if (b.err) throw new Error(b.err)
|
||||||
if (!b.svcResL || !b.svcResL[0]) return new Error('invalid response')
|
if (!b.svcResL || !b.svcResL[0]) throw new Error('invalid response')
|
||||||
if (b.svcResL[0].err !== 'OK') return new Error(b.svcResL[0].errTxt)
|
if (b.svcResL[0].err !== 'OK') throw new Error(b.svcResL[0].errTxt)
|
||||||
const d = b.svcResL[0].res
|
const d = b.svcResL[0].res
|
||||||
const c = d.common || {}
|
const c = d.common || {}
|
||||||
|
|
||||||
|
|
1
parse.js
1
parse.js
|
@ -86,6 +86,7 @@ const part = (tz, s, p, r, c) => (pt) => {
|
||||||
result.product = p[parseInt(pt.jny.prodX)]
|
result.product = p[parseInt(pt.jny.prodX)]
|
||||||
result.direction = pt.jny.dirTxt // todo: parse this
|
result.direction = pt.jny.dirTxt // todo: parse this
|
||||||
if (pt.jny.stopL) result.passed = pt.jny.stopL.map(stop(tz, s, p, r, c))
|
if (pt.jny.stopL) result.passed = pt.jny.stopL.map(stop(tz, s, p, r, c))
|
||||||
|
if (Array.isArray(pt.jny.remL))
|
||||||
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
||||||
|
|
||||||
if (pt.jny.freq && pt.jny.freq.jnyL)
|
if (pt.jny.freq && pt.jny.freq.jnyL)
|
||||||
|
|
Loading…
Add table
Reference in a new issue