db-vendo-client/parse/trip.js
2025-01-14 21:07:23 +00:00

17 lines
366 B
JavaScript

const parseTrip = (ctx, t, id) => { // t = raw trip
const {profile} = ctx;
// pretend the trip is a leg in a journey
const trip = profile.parseJourneyLeg(ctx, t);
trip.id = trip.tripId || id;
delete trip.tripId;
delete trip.reachable;
trip.cancelled = Boolean(profile.parseCancelled(t));
// TODO opt.scheduledDays
return trip;
};
export {
parseTrip,
};