parseArrOrDep, parseLocation: bugfixes 🐛

This commit is contained in:
Jannis R 2019-10-28 17:43:12 +01:00
parent 9ce72930b1
commit 1cc453b778
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 2 additions and 2 deletions

View file

@ -59,7 +59,7 @@ const createParseArrOrDep = (profile, opt, data, prefix) => {
.filter(rem => !!rem) // filter unparsable
}
if (opt.stopovers && d.stopL) {
if (opt.stopovers && Array.isArray(d.stopL)) {
const parse = profile.parseStopover(profile, opt, data, d.date)
// Filter stations the train passes without stopping, as this doesn't comply with FPTF (yet).
const stopovers = d.stopL.map(parse).filter(st => !st.passBy)

View file

@ -25,7 +25,7 @@ const parseLocation = (profile, opt, {lines}, l) => {
const stop = {
type: l.isMainMast ? 'station' : 'stop',
id: res.id,
name: l.name ? profile.parseStationName(l.name) : null,
name: l.name || id.O ? profile.parseStationName(l.name || id.O) : null,
location: 'number' === typeof res.latitude ? res : null // todo: remove `.id`
}