From 9d969027941be04fc6af5766cd0eea50ca3daeb2 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Thu, 1 Nov 2018 19:38:29 +0100 Subject: [PATCH] readableFrom: make maxDuration optional [ci skip] --- docs/reachable-from.md | 2 +- index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reachable-from.md b/docs/reachable-from.md index 2e6befbd..7f9c51ad 100644 --- a/docs/reachable-from.md +++ b/docs/reachable-from.md @@ -12,7 +12,7 @@ With `opt`, you can override the default options, which look like this: { when: new Date(), 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: { // These entries may vary from profile to profile! suburban: true, diff --git a/index.js b/index.js index 66535db4..baae4860 100644 --- a/index.js +++ b/index.js @@ -470,7 +470,7 @@ const createClient = (profile, userAgent, request = _request) => { opt = Object.assign({ when: Date.now(), 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: {} }, opt) if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid') @@ -480,7 +480,7 @@ const createClient = (profile, userAgent, request = _request) => { meth: 'LocGeoReach', req: { loc: profile.formatLocation(profile, address, 'address'), - maxDur: opt.maxDuration, + maxDur: opt.maxDuration === null ? -1 : opt.maxDuration, maxChg: opt.maxTransfers, date: profile.formatDate(profile, opt.when), time: profile.formatTime(profile, opt.when),