mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
readableFrom: make maxDuration optional
[ci skip]
This commit is contained in:
parent
02e0e513ef
commit
9d96902794
2 changed files with 3 additions and 3 deletions
|
@ -12,7 +12,7 @@ With `opt`, you can override the default options, which look like this:
|
||||||
{
|
{
|
||||||
when: new Date(),
|
when: new Date(),
|
||||||
maxTransfers: 5, // maximum of 5 transfers
|
maxTransfers: 5, // maximum of 5 transfers
|
||||||
maxDuration: 20, // maximum travel duration in minutes
|
maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite
|
||||||
products: {
|
products: {
|
||||||
// These entries may vary from profile to profile!
|
// These entries may vary from profile to profile!
|
||||||
suburban: true,
|
suburban: true,
|
||||||
|
|
4
index.js
4
index.js
|
@ -470,7 +470,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
opt = Object.assign({
|
opt = Object.assign({
|
||||||
when: Date.now(),
|
when: Date.now(),
|
||||||
maxTransfers: 5, // maximum of 5 transfers
|
maxTransfers: 5, // maximum of 5 transfers
|
||||||
maxDuration: 20, // maximum travel duration in minutes
|
maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite
|
||||||
products: {}
|
products: {}
|
||||||
}, opt)
|
}, opt)
|
||||||
if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
|
if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
|
||||||
|
@ -480,7 +480,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
meth: 'LocGeoReach',
|
meth: 'LocGeoReach',
|
||||||
req: {
|
req: {
|
||||||
loc: profile.formatLocation(profile, address, 'address'),
|
loc: profile.formatLocation(profile, address, 'address'),
|
||||||
maxDur: opt.maxDuration,
|
maxDur: opt.maxDuration === null ? -1 : opt.maxDuration,
|
||||||
maxChg: opt.maxTransfers,
|
maxChg: opt.maxTransfers,
|
||||||
date: profile.formatDate(profile, opt.when),
|
date: profile.formatDate(profile, opt.when),
|
||||||
time: profile.formatTime(profile, opt.when),
|
time: profile.formatTime(profile, opt.when),
|
||||||
|
|
Loading…
Add table
Reference in a new issue