mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
pass all data into parseHint/parseWarning 💥
This commit is contained in:
parent
b8496be1a3
commit
35e44d4c92
3 changed files with 14 additions and 13 deletions
|
@ -22,15 +22,6 @@ const parseCommonData = (profile, opt, raw) => {
|
||||||
res.icons = []
|
res.icons = []
|
||||||
if (Array.isArray(c.icoL)) res.icons = c.icoL.map(parseIcon)
|
if (Array.isArray(c.icoL)) res.icons = c.icoL.map(parseIcon)
|
||||||
|
|
||||||
res.hints = []
|
|
||||||
if (opt.remarks && Array.isArray(c.remL)) {
|
|
||||||
res.hints = c.remL.map(hint => profile.parseHint(profile, hint, res.icons))
|
|
||||||
}
|
|
||||||
res.warnings = []
|
|
||||||
if (opt.remarks && Array.isArray(c.himL)) {
|
|
||||||
res.warnings = c.himL.map(w => profile.parseWarning(profile, w, res.icons))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(c.prodL)) {
|
if (Array.isArray(c.prodL)) {
|
||||||
const parse = profile.parseLine(profile, opt, res)
|
const parse = profile.parseLine(profile, opt, res)
|
||||||
res.lines = c.prodL.map(parse)
|
res.lines = c.prodL.map(parse)
|
||||||
|
@ -50,6 +41,15 @@ const parseCommonData = (profile, opt, raw) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.hints = []
|
||||||
|
if (opt.remarks && Array.isArray(c.remL)) {
|
||||||
|
res.hints = c.remL.map(hint => profile.parseHint(profile, hint, {...c, ...res}))
|
||||||
|
}
|
||||||
|
res.warnings = []
|
||||||
|
if (opt.remarks && Array.isArray(c.himL)) {
|
||||||
|
res.warnings = c.himL.map(w => profile.parseWarning(profile, w, {...c, ...res}))
|
||||||
|
}
|
||||||
|
|
||||||
res.polylines = []
|
res.polylines = []
|
||||||
if (opt.polylines && Array.isArray(c.polyL)) res.polylines = c.polyL
|
if (opt.polylines && Array.isArray(c.polyL)) res.polylines = c.polyL
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ const codesByIcon = Object.assign(Object.create(null), {
|
||||||
// "tagL": [
|
// "tagL": [
|
||||||
// "RES_JNY_DTL" // only shown in journey detail
|
// "RES_JNY_DTL" // only shown in journey detail
|
||||||
// ]
|
// ]
|
||||||
const parseHint = (profile, h, icons) => {
|
const parseHint = (profile, h, data) => {
|
||||||
|
const icons = data.icoL || []
|
||||||
// todo: C
|
// todo: C
|
||||||
|
|
||||||
const text = h.txtN && h.txtN.trim() || ''
|
const text = h.txtN && h.txtN.trim() || ''
|
||||||
|
|
|
@ -9,9 +9,9 @@ const typesByIcon = Object.assign(Object.create(null), {
|
||||||
})
|
})
|
||||||
|
|
||||||
// todo: is passing in profile necessary?
|
// todo: is passing in profile necessary?
|
||||||
const parseWarning = (profile, w, icons) => {
|
const parseWarning = (profile, w, data) => {
|
||||||
// todo: pass `d`/`d.common` in, parse `w.fLocX`/`w.tLocX`/`w.icoX`
|
const icons = data.icoL || []
|
||||||
// todo: hid, act, pub, lead, tckr, comp,
|
// todo: hid, act, pub, lead, tckr, icoX, fLocX, tLocX, prod, comp,
|
||||||
// todo: cat (1, 2), pubChL
|
// todo: cat (1, 2), pubChL
|
||||||
// pubChL:
|
// pubChL:
|
||||||
// [ { name: 'timetable',
|
// [ { name: 'timetable',
|
||||||
|
|
Loading…
Add table
Reference in a new issue