mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parse: minor changes
This commit is contained in:
parent
bff7384f06
commit
4270125bf7
5 changed files with 6 additions and 2 deletions
1
index.js
1
index.js
|
@ -231,6 +231,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
|||
})
|
||||
.then((d) => {
|
||||
if (!Array.isArray(d.outConL)) return []
|
||||
// todo: outConGrpL
|
||||
|
||||
const parse = profile.parseJourney(profile, opt, d)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ const parseCommonData = (profile, opt, raw) => {
|
|||
const res = Object.assign({}, raw)
|
||||
const c = raw.common || {}
|
||||
|
||||
res.operators = []
|
||||
if (Array.isArray(c.opL)) {
|
||||
res.operators = c.opL.map(op => profile.parseOperator(profile, op))
|
||||
}
|
||||
|
@ -22,11 +23,13 @@ const parseCommonData = (profile, opt, raw) => {
|
|||
res.icons = []
|
||||
if (Array.isArray(c.icoL)) res.icons = c.icoL.map(parseIcon)
|
||||
|
||||
res.lines = []
|
||||
if (Array.isArray(c.prodL)) {
|
||||
const parse = profile.parseLine(profile, opt, res)
|
||||
res.lines = c.prodL.map(parse)
|
||||
}
|
||||
|
||||
res.locations = []
|
||||
if (Array.isArray(c.locL)) {
|
||||
const parse = loc => profile.parseLocation(profile, opt, res, loc)
|
||||
res.locations = c.locL.map(parse)
|
||||
|
|
|
@ -118,7 +118,6 @@ const createParseJourneyLeg = (profile, opt, data) => {
|
|||
const stopL = pt.jny.stopL
|
||||
res.stopovers = stopL.map(parse)
|
||||
|
||||
// todo: is there a `pt.jny.remL`?
|
||||
if (opt.remarks && Array.isArray(pt.jny.msgL)) {
|
||||
for (let i = 0; i < stopL.length; i++) {
|
||||
Object.defineProperty(res.stopovers[i], locX, {
|
||||
|
|
|
@ -10,6 +10,7 @@ const createParseLine = (profile, opt, {operators}) => {
|
|||
}
|
||||
}
|
||||
|
||||
// todo: p.himIdL
|
||||
const parseLine = (p) => {
|
||||
if (!p) return null // todo: handle this upstream
|
||||
const name = p.line || p.addName || p.name || null // wtf
|
||||
|
|
|
@ -29,7 +29,7 @@ const parseMsgEvent = (profile, data) => (e) => {
|
|||
|
||||
const parseWarning = (profile, w, data) => {
|
||||
const icons = data.icoL || []
|
||||
// todo: act, pub, lead, tckr, fLocX, tLocX, prod, comp,
|
||||
// todo: act, pub, lead, tckr, prod, comp,
|
||||
// todo: cat (1, 2), pubChL, rRefL, impactL
|
||||
// pubChL:
|
||||
// [ { name: 'timetable',
|
||||
|
|
Loading…
Add table
Reference in a new issue