mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
From now on, all higher-level parse fns will be able to access more of the response data while keeping their signature. - parseLine - parseDeparture - parseJourney - parseJourneyLeg - parseLocation - parseMovement - parsePolyline - parseNearby - parseStopover
24 lines
451 B
JavaScript
24 lines
451 B
JavaScript
'use strict'
|
|
|
|
const clone = obj => Object.assign({}, obj)
|
|
|
|
const createParseJourney = (profile, data) => {
|
|
const parseLeg = profile.parseJourneyLeg(profile, data)
|
|
|
|
// todo: c.sDays
|
|
// todo: c.conSubscr
|
|
// todo: c.trfRes x vbb-parse-ticket
|
|
const parseJourney = (j) => {
|
|
const legs = j.secL.map(leg => parseLeg(j, leg))
|
|
const res = {
|
|
type: 'journey',
|
|
legs
|
|
}
|
|
|
|
return res
|
|
}
|
|
|
|
return parseJourney
|
|
}
|
|
|
|
module.exports = createParseJourney
|