Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/hafas-find-alternative-legs
Given a journey, get alternatives for each leg from HAFAS.
https://github.com/derhuerst/hafas-find-alternative-legs
Last synced: 6 days ago
JSON representation
Given a journey, get alternatives for each leg from HAFAS.
- Host: GitHub
- URL: https://github.com/derhuerst/hafas-find-alternative-legs
- Owner: derhuerst
- License: isc
- Created: 2019-02-22T14:16:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-12T06:03:51.000Z (over 4 years ago)
- Last Synced: 2024-11-07T14:06:27.703Z (7 days ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# hafas-find-alternative-legs
**Given a [`hafas-client`](https://npmjs.com/package/hafas-client) journey, get alternatives for each leg from HAFAS.**
[![npm version](https://img.shields.io/npm/v/hafas-find-alternative-legs.svg)](https://www.npmjs.com/package/hafas-find-alternative-legs)
[![build status](https://api.travis-ci.org/derhuerst/hafas-find-alternative-legs.svg?branch=master)](https://travis-ci.org/derhuerst/hafas-find-alternative-legs)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/hafas-find-alternative-legs.svg)
[![chat with me on Gitter](https://img.shields.io/badge/chat%20with%20me-on%20gitter-512e92.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)## Installation
```shell
npm install hafas-find-alternative-legs
```## Usage
```js
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](https://github.com/derhuerst/hafas-find-alternative-legs/issues).