From 36806ce894f51097068dc266a56b8d14c8a635d1 Mon Sep 17 00:00:00 2001 From: dabund24 Date: Wed, 5 Feb 2025 13:23:57 +0100 Subject: [PATCH] add optional chaining in line.js --- parse/line.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse/line.js b/parse/line.js index d544de93..1193fd1b 100644 --- a/parse/line.js +++ b/parse/line.js @@ -2,7 +2,7 @@ import slugg from 'slugg'; const parseLine = (ctx, p) => { const profile = ctx.profile; - const fahrtNr = p.verkehrsmittel?.nummer || p.transport?.number || p.train?.no || p.no || ((p.risZuglaufId || '') + '_').split('_')[1] || p.verkehrsmittelNummer || ((p.verkehrmittel.langText || '') + ' ').split(' ')[1] || ((p.mitteltext || '') + ' ').split(' ')[1] || ((p.zugName || '') + ' ').split(' ')[1]; + const fahrtNr = p.verkehrsmittel?.nummer || p.transport?.number || p.train?.no || p.no || ((p.risZuglaufId || '') + '_').split('_')[1] || p.verkehrsmittelNummer || ((p.verkehrmittel?.langText || '') + ' ').split(' ')[1] || ((p.mitteltext || '') + ' ').split(' ')[1] || ((p.zugName || '') + ' ').split(' ')[1]; const res = { type: 'line', id: slugg(p.verkehrsmittel?.langText || p.verkehrmittel?.langText || p.transport?.journeyDescription || p.risZuglaufId || p.train && p.train.category + ' ' + p.train.lineName + ' ' + p.train.no || p.no && p.name + ' ' + p.no || p.langtext || p.mitteltext || p.zugName), // TODO terrible