How to use the hafas-client/parse.line 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 line = (p) => {
	const r = parse.line(p)
	if (!r) return null
	if (r.productCode) {
		r.productCode = parseInt(r.productCode)
		r.product = (util.products.categories[r.productCode] || {}).type || null
		r.mode = modes[r.productCode]
		r.public = true
	} else if (r.class) {
		r.product = (util.products.bitmasks[r.class] || {}).type || null
		r.mode = modesByClass[r.class]
		r.public = true
	}
	if (r.name) {
		r.id = slugg(r.name.trim())

		const l = parseLineName(r.name)
		if (l && l.type) {