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:
Jannis R 2020-03-03 18:06:46 +01:00 committed by Jannis Redmann
parent 3ea9380218
commit 8c7f164fa3
3 changed files with 8 additions and 0 deletions

View file

@ -21,6 +21,10 @@ const parseLine = ({profile}, p) => {
// todo: what is p.number? // todo: what is p.number?
// todo: what is p.prodCtx.catCode? // todo: what is p.prodCtx.catCode?
if (p.prodCtx && 'string' === typeof p.prodCtx.admin) {
res.adminCode = p.prodCtx.admin.replace(/-+$/, '')
}
if ('cls' in p) { if ('cls' in p) {
// todo: use profile.products.find() for this // todo: use profile.products.find() for this
const byBitmask = [] const byBitmask = []

View file

@ -702,6 +702,7 @@ module.exports = {
id: 's-bahn-berlin-gmbh', id: 's-bahn-berlin-gmbh',
name: 'S-Bahn Berlin GmbH' name: 'S-Bahn Berlin GmbH'
}, },
adminCode: 'DBS',
symbol: 'S', symbol: 'S',
nr: 2, nr: 2,
metro: false, metro: false,

View file

@ -191,6 +191,7 @@ module.exports = [
fahrtNr: '19869', fahrtNr: '19869',
name: 'U8', name: 'U8',
public: true, public: true,
adminCode: 'BVU',
mode: 'train', mode: 'train',
product: 'subway', product: 'subway',
operator: { operator: {
@ -854,6 +855,7 @@ module.exports = [
fahrtNr: '19453', fahrtNr: '19453',
name: 'U8', name: 'U8',
public: true, public: true,
adminCode: 'BVU',
mode: 'train', mode: 'train',
product: 'subway', product: 'subway',
operator: { operator: {
@ -1612,6 +1614,7 @@ module.exports = [
fahrtNr: '27739', fahrtNr: '27739',
name: 'S9', name: 'S9',
public: true, public: true,
adminCode: 'DBS',
mode: 'train', mode: 'train',
product: 'suburban', product: 'suburban',
operator: { operator: {