Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const journeys = (from, to, opt) => {
from = location(from)
to = location(to)
opt = opt || {}
opt.products = Object.assign({}, defaults.products, opt.products)
opt = Object.assign({}, defaults, opt)
opt.when = opt.when || new Date()
const filters = [
_stringify.products(opt.products)
, stringify.accessibility[opt.accessibility]
]
if (opt.bike) filters.push(stringify.bike)
// todo: add req.gisFltrL
return request({
cfg: {polyEnc: 'GPA'}
, meth: 'TripSearch'
, req: {
outDate: _stringify.date(opt.when)
, outTime: _stringify.time(opt.when)
, numF: opt.results
, getPasslist: opt.passedStations
, maxChg: opt.transfers
, minChgTime: opt.transferTime
, depLocL: [from]
, viaLocL: opt.via ? [{loc: {type: 'S', lid: 'L=' + opt.via}}] : null
, arrLocL: [to]
, jnyFltrL: [filters]