db-vendo-client/parse/trip.js

18 lines
366 B
JavaScript
Raw Normal View History

const parseTrip = (ctx, t, id) => { // t = raw trip
2024-12-08 21:42:57 +00:00
const {profile} = ctx;
2020-06-11 15:33:45 +02:00
// pretend the trip is a leg in a journey
2024-12-18 01:16:57 +00:00
const trip = profile.parseJourneyLeg(ctx, t);
trip.id = trip.tripId || id;
delete trip.tripId;
delete trip.reachable;
trip.cancelled = Boolean(profile.parseCancelled(t));
2020-06-11 15:33:45 +02:00
2024-12-07 16:16:31 +00:00
// TODO opt.scheduledDays
return trip;
};
2020-06-11 15:33:45 +02:00
2022-05-07 16:17:37 +02:00
export {
parseTrip,
};