How to use the hafas-client/parse.departure function in hafas-client

To help you get started, we’ve selected a few hafas-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github derhuerst / vbb-hafas / lib / departures.js View on Github external
.then((d) => {
		return Array.isArray(d.jnyL)
		? d.jnyL
			.map(parse.departure('Europe/Berlin', d.locations, d.lines, d.remarks))
			.map((dep) => {
				dep.station.name = shorten(dep.station.name)
				dep.direction = shorten(dep.direction)
				return dep
			})
			.sort((a, b) => new Date(a.when) - new Date(b.when))
		: []
	})
}