Home

Awesome

hafas-find-alternative-legs

Given a hafas-client journey, get alternatives for each leg from HAFAS.

npm version build status ISC-licensed chat with me on Gitter support me on Patreon

Installation

npm install hafas-find-alternative-legs

Usage

const createHafas = require('bvg-hafas')
const createFetchAlternatives = require('hafas-find-alternative-legs')

const hafas = createHafas('my awesome program')
const fetchAlternatives = createFetchAlternatives(hafas)

const friedrichstr = '900000100001'
const senefelderplatz = '900000110005'

hafas.journeys(friedrichstr, senefelderplatz, {results: 1})
.then(([journey]) => fetchAlternatives(journey))
.then((journeyWithAlternatives) => {
	console.log(journeyWithAlternatives.legs)
})
.catch(console.error)

Contributing

If you have a question or need support using hafas-find-alternative-legs, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.