db-vendo-client/format/station-board-req.js
Kristjan ESPERANTO 66d9fb5194
apply linting rules
follow-up of 228c7253
2024-02-10 16:50:12 +01:00

42 lines
881 B
JavaScript

const formatStationBoardReq = (ctx, station, type) => {
const {profile, opt} = ctx;
const jnyFltrL = [
profile.formatProductsFilter(ctx, opt.products || {}),
];
if (opt.line !== null) {
jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line});
}
const req = {
type,
date: profile.formatDate(profile, opt.when),
time: profile.formatTime(profile, opt.when),
stbLoc: station,
dirLoc: opt.direction
? profile.formatStation(opt.direction)
: undefined,
jnyFltrL,
dur: opt.duration,
};
if (opt.results !== null) {
req.maxJny = opt.results === Infinity
? 10000
: opt.results;
}
if (profile.departuresGetPasslist) {
req.getPasslist = Boolean(opt.stopovers);
}
if (profile.departuresStbFltrEquiv) {
req.stbFltrEquiv = !opt.includeRelatedStations;
}
return {
meth: 'StationBoard',
req,
};
};
export {
formatStationBoardReq,
};