mirror of
				https://github.com/public-transport/db-vendo-client.git
				synced 2025-10-31 08:06:33 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			848 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			848 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict'
 | |
| 
 | |
| 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) : null,
 | |
| 		jnyFltrL,
 | |
| 		dur: opt.duration
 | |
| 	}
 | |
| 	if (opt.results !== null) {
 | |
| 		req.maxJny = opt.results === Infinity ? 10000 : opt.results
 | |
| 	}
 | |
| 	if (profile.departuresGetPasslist) req.getPasslist = !!opt.stopovers
 | |
| 	if (profile.departuresStbFltrEquiv) req.stbFltrEquiv = !opt.includeRelatedStations
 | |
| 
 | |
| 	return {
 | |
| 		meth: 'StationBoard',
 | |
| 		req
 | |
| 	}
 | |
| }
 | |
| 
 | |
| module.exports = formatStationBoardReq
 |