mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
more line info
This commit is contained in:
parent
d77c450d11
commit
275c9e54d7
3 changed files with 19 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
const shorten = require('vbb-short-station-name')
|
||||
const {to12Digit, to9Digit} = require('vbb-translate-ids')
|
||||
const parseLineName = require('vbb-parse-line')
|
||||
|
||||
const _formatStation = require('../../format/station')
|
||||
const _parseLine = require('../../parse/line')
|
||||
|
@ -34,6 +35,13 @@ const parseLine = (profile, l) => {
|
|||
}
|
||||
}
|
||||
|
||||
const details = parseLineName(l.name)
|
||||
res.symbol = details.symbol
|
||||
res.nr = details.nr
|
||||
res.metro = details.metro
|
||||
res.express = details.express
|
||||
res.night = details.night
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,7 @@ const parseLine = (profile, p) => {
|
|||
}
|
||||
|
||||
if (p.cls) res.class = p.cls
|
||||
if (p.prodCtx) {
|
||||
res.productCode = +p.prodCtx.catCode
|
||||
res.productName = p.prodCtx.catOutS
|
||||
}
|
||||
if (p.prodCtx) res.productCode = +p.prodCtx.catCode
|
||||
|
||||
// todo: parse mode, remove from profiles
|
||||
|
||||
|
|
11
test/vbb.js
11
test/vbb.js
|
@ -15,7 +15,7 @@ const {
|
|||
assertValidPoi,
|
||||
assertValidAddress,
|
||||
assertValidLocation,
|
||||
assertValidLine,
|
||||
assertValidLine: _assertValidLine,
|
||||
assertValidStopover,
|
||||
hour, when,
|
||||
assertValidWhen
|
||||
|
@ -32,6 +32,15 @@ const assertValidStationProducts = (t, p) => {
|
|||
t.equal(typeof p.regional, 'boolean')
|
||||
}
|
||||
|
||||
const assertValidLine = (t, l) => {
|
||||
_assertValidLine(t, l)
|
||||
if (l.symbol !== null) t.equal(typeof l.symbol, 'string')
|
||||
if (l.nr !== null) t.equal(typeof l.nr, 'number')
|
||||
if (l.metro !== null) t.equal(typeof l.metro, 'boolean')
|
||||
if (l.express !== null) t.equal(typeof l.express, 'boolean')
|
||||
if (l.night !== null) t.equal(typeof l.night, 'boolean')
|
||||
}
|
||||
|
||||
// todo
|
||||
const findStation = (query) => stations(query, true, false)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue