mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
throw error if products filter is empty
This commit is contained in:
parent
b0eb6d6474
commit
851e68d3c4
2 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
const createFormatBitmask = (modes) => {
|
||||
const formatBitmask = (products) => {
|
||||
if(Object.keys(products).length === 0) return null
|
||||
if(Object.keys(products).length === 0) throw new Error('products filter must not be empty')
|
||||
let bitmask = 0
|
||||
for (let product in products) {
|
||||
if (products[product] === true) bitmask += modes[product].bitmask
|
||||
|
|
6
index.js
6
index.js
|
@ -30,7 +30,7 @@ const createClient = (profile) => {
|
|||
time: profile.formatTime(profile, opt.when),
|
||||
stbLoc: profile.formatStation(station),
|
||||
dirLoc: dir,
|
||||
jnyFltrL: [products].filter(x => x !== null),
|
||||
jnyFltrL: [products],
|
||||
dur: opt.duration,
|
||||
getPasslist: false
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ const createClient = (profile) => {
|
|||
|
||||
const filters = [
|
||||
profile.formatProducts(opt.products || {})
|
||||
].filter(x => x !== null)
|
||||
]
|
||||
if (
|
||||
opt.accessibility &&
|
||||
profile.filters &&
|
||||
|
@ -226,7 +226,7 @@ const createClient = (profile) => {
|
|||
ageOfReport: true, // todo: what is this?
|
||||
jnyFltrL: [
|
||||
profile.formatProducts(opt.products || {})
|
||||
].filter(x => x !== null),
|
||||
],
|
||||
trainPosMode: 'CALC' // todo: what is this? what about realtime?
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue