parse: minor changes

This commit is contained in:
Jannis R 2019-08-23 15:36:57 +02:00
parent bff7384f06
commit 4270125bf7
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
5 changed files with 6 additions and 2 deletions

View file

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

View file

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

View file

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

View file

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

View file

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