diff --git a/.eslintrc.json b/.eslintrc.json index 75300be2..a53c0f0d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,8 +14,6 @@ "ecmaVersion": 2018 }, "rules": { - "no-irregular-whitespace": "off", - "no-mixed-spaces-and-tabs": "off", "no-unused-vars": [ "error", { diff --git a/index.js b/index.js index aaf9b9f3..7b9ca4ac 100644 --- a/index.js +++ b/index.js @@ -111,7 +111,7 @@ const createClient = (profile, userAgent, opt = {}) => { } opt = Object.assign({ - results: null, // number of journeys – `null` means "whatever HAFAS returns" + results: null, // number of journeys – `null` means "whatever HAFAS returns" via: null, // let journeys pass this station? stopovers: false, // return stations on the way? transfers: -1, // maximum of 5 transfers diff --git a/parse/arrival-or-departure.js b/parse/arrival-or-departure.js index f0329396..90b4b3ec 100644 --- a/parse/arrival-or-departure.js +++ b/parse/arrival-or-departure.js @@ -44,14 +44,14 @@ const createParseArrOrDep = (prefix) => { ]).map(([remark]) => remark) } - if (opt.stopovers && Array.isArray(d.stopL)) { - // Filter stations the train passes without stopping, as this doesn't comply with FPTF (yet). - const stopovers = d.stopL - .map(st => profile.parseStopover(ctx, st, d.date)) - .filter(st => !st.passBy) - if (prefix === ARRIVAL) res.previousStopovers = stopovers + if (opt.stopovers && Array.isArray(d.stopL)) { + // Filter stations the train passes without stopping, as this doesn't comply with FPTF (yet). + const stopovers = d.stopL + .map(st => profile.parseStopover(ctx, st, d.date)) + .filter(st => !st.passBy) + if (prefix === ARRIVAL) res.previousStopovers = stopovers else if (prefix === DEPARTURE) res.nextStopovers = stopovers - } + } return res }