mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09: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 shorten = require('vbb-short-station-name')
|
||||||
const {to12Digit, to9Digit} = require('vbb-translate-ids')
|
const {to12Digit, to9Digit} = require('vbb-translate-ids')
|
||||||
|
const parseLineName = require('vbb-parse-line')
|
||||||
|
|
||||||
const _formatStation = require('../../format/station')
|
const _formatStation = require('../../format/station')
|
||||||
const _parseLine = require('../../parse/line')
|
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
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,7 @@ const parseLine = (profile, p) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.cls) res.class = p.cls
|
if (p.cls) res.class = p.cls
|
||||||
if (p.prodCtx) {
|
if (p.prodCtx) res.productCode = +p.prodCtx.catCode
|
||||||
res.productCode = +p.prodCtx.catCode
|
|
||||||
res.productName = p.prodCtx.catOutS
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: parse mode, remove from profiles
|
// todo: parse mode, remove from profiles
|
||||||
|
|
||||||
|
|
11
test/vbb.js
11
test/vbb.js
|
@ -15,7 +15,7 @@ const {
|
||||||
assertValidPoi,
|
assertValidPoi,
|
||||||
assertValidAddress,
|
assertValidAddress,
|
||||||
assertValidLocation,
|
assertValidLocation,
|
||||||
assertValidLine,
|
assertValidLine: _assertValidLine,
|
||||||
assertValidStopover,
|
assertValidStopover,
|
||||||
hour, when,
|
hour, when,
|
||||||
assertValidWhen
|
assertValidWhen
|
||||||
|
@ -32,6 +32,15 @@ const assertValidStationProducts = (t, p) => {
|
||||||
t.equal(typeof p.regional, 'boolean')
|
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
|
// todo
|
||||||
const findStation = (query) => stations(query, true, false)
|
const findStation = (query) => stations(query, true, false)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue