diff --git a/format/products-bitmask.js b/format/products-bitmask.js index 9ec158e0..af2a6361 100644 --- a/format/products-bitmask.js +++ b/format/products-bitmask.js @@ -2,6 +2,7 @@ const createFormatBitmask = (modes) => { const formatBitmask = (products) => { + if(Object.keys(products).length === 0) return null let bitmask = 0 for (let product in products) { if (products[product] === true) bitmask += modes[product].bitmask diff --git a/index.js b/index.js index 93409c1c..b4c14de7 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,7 @@ const createClient = (profile) => { time: profile.formatTime(profile, opt.when), stbLoc: profile.formatStation(station), dirLoc: dir, - jnyFltrL: [products], + jnyFltrL: [products].filter(x => x !== null), 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? } })