mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parseLine: expose adminCode
The admin code is often helpful to distinguish lines that can't be distinguished by their `operator.id`. See also #10.
This commit is contained in:
parent
3ea9380218
commit
8c7f164fa3
3 changed files with 8 additions and 0 deletions
|
@ -21,6 +21,10 @@ const parseLine = ({profile}, p) => {
|
|||
// todo: what is p.number?
|
||||
// todo: what is p.prodCtx.catCode?
|
||||
|
||||
if (p.prodCtx && 'string' === typeof p.prodCtx.admin) {
|
||||
res.adminCode = p.prodCtx.admin.replace(/-+$/, '')
|
||||
}
|
||||
|
||||
if ('cls' in p) {
|
||||
// todo: use profile.products.find() for this
|
||||
const byBitmask = []
|
||||
|
|
1
test/fixtures/bvg-journey.js
vendored
1
test/fixtures/bvg-journey.js
vendored
|
@ -702,6 +702,7 @@ module.exports = {
|
|||
id: 's-bahn-berlin-gmbh',
|
||||
name: 'S-Bahn Berlin GmbH'
|
||||
},
|
||||
adminCode: 'DBS',
|
||||
symbol: 'S',
|
||||
nr: 2,
|
||||
metro: false,
|
||||
|
|
3
test/fixtures/vbb-departures.js
vendored
3
test/fixtures/vbb-departures.js
vendored
|
@ -191,6 +191,7 @@ module.exports = [
|
|||
fahrtNr: '19869',
|
||||
name: 'U8',
|
||||
public: true,
|
||||
adminCode: 'BVU',
|
||||
mode: 'train',
|
||||
product: 'subway',
|
||||
operator: {
|
||||
|
@ -854,6 +855,7 @@ module.exports = [
|
|||
fahrtNr: '19453',
|
||||
name: 'U8',
|
||||
public: true,
|
||||
adminCode: 'BVU',
|
||||
mode: 'train',
|
||||
product: 'subway',
|
||||
operator: {
|
||||
|
@ -1612,6 +1614,7 @@ module.exports = [
|
|||
fahrtNr: '27739',
|
||||
name: 'S9',
|
||||
public: true,
|
||||
adminCode: 'DBS',
|
||||
mode: 'train',
|
||||
product: 'suburban',
|
||||
operator: {
|
||||
|
|
Loading…
Add table
Reference in a new issue