Home

Awesome

hafas-estimate-station-weight

Pass in a hafas-client@6-compatible HAFAS API client and estimate the importance/weight of a station.

npm version ISC-licensed support me via GitHub Sponsors chat with me on Twitter

Installing

npm install hafas-estimate-station-weight

Usage

import {createEstimate} from 'hafas-estimate-station-weight'
import {createVbbHafas} from 'vbb-hafas' // can be any `hafas-client`-compatible client
import vbbWeights from 'vbb-mode-weights'

const hafas = createVbbHafas('my-awesome-program')
const estimate = createEstimate(hafas, vbbWeights)

const friedrichstr = '900100001'

const weight = await estimate(friedrichstr)
console.log('weight of S+U Friedrichstr. is', weight)
// weight of S+U Friedrichstr. is 1809.8

Estimating the weight of a station will take ~20s, because several requests will be made.

Contributing

If you have a question or have difficulties using hafas-estimate-station-weight, 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.