How to use the hafas-client/parse.location 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 / parse.js View on Github external
const location = (l) => {
	const r = parse.location(l)

	if (r.id) r.id = to12Digit(r.id.replace(leadingZeros, ''))
	if ('products' in r) r.products = util.products.parseBitmask(r.products)
	if (r.type === 'station' && !r.coordinates) {
		const [s] = stations(r.id)
		if (s) {
			r.coordinates = {
				latitude: s.coordinates.latitude,
				longitude: s.coordinates.longitude
			}
		}
	}
	return r
}