mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
handle stop objects as input 🐛, 3.8.1
This commit is contained in:
parent
b84db19efb
commit
3f58d84de5
3 changed files with 9 additions and 3 deletions
|
@ -3,7 +3,9 @@
|
|||
const formatLocation = (profile, l, name = 'location') => {
|
||||
if ('string' === typeof l) return profile.formatStation(l)
|
||||
if ('object' === typeof l && !Array.isArray(l)) {
|
||||
if (l.type === 'station') return profile.formatStation(l.id)
|
||||
if (l.type === 'station' || l.type === 'stop') {
|
||||
return profile.formatStation(l.id)
|
||||
}
|
||||
if ('string' === typeof l.id) return profile.formatPoi(l)
|
||||
if ('string' === typeof l.address) return profile.formatAddress(l)
|
||||
if (!l.type) throw new Error(`missing ${name}.type`)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "hafas-client",
|
||||
"description": "Client for HAFAS public transport APIs.",
|
||||
"version": "3.8.0",
|
||||
"version": "3.8.1",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
|
|
@ -50,7 +50,11 @@ const wedding = '900000009104'
|
|||
const württembergallee = '900000026153'
|
||||
|
||||
test('journeys – Spichernstr. to Bismarckstr.', co(function* (t) {
|
||||
const journeys = yield client.journeys(spichernstr, bismarckstr, {
|
||||
const journeys = yield client.journeys({
|
||||
type: 'stop',
|
||||
id: spichernstr,
|
||||
name: 'U Spichernstr.'
|
||||
}, bismarckstr, {
|
||||
results: 3,
|
||||
departure: when,
|
||||
stopovers: true
|
||||
|
|
Loading…
Add table
Reference in a new issue