mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
locations, nearby: opt.stations -> opt.stops 💥 📝
This commit is contained in:
parent
d7e439b948
commit
8f9b22e296
4 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ With `opt`, you can override the default options, which look like this:
|
||||||
{
|
{
|
||||||
fuzzy: true // find only exact matches?
|
fuzzy: true // find only exact matches?
|
||||||
, results: 5 // how many search results?
|
, results: 5 // how many search results?
|
||||||
, stations: true
|
, stops: true // return stops/stations?
|
||||||
, addresses: true
|
, addresses: true
|
||||||
, poi: true // points of interest
|
, poi: true // points of interest
|
||||||
, stationLines: false // parse & expose lines of the station?
|
, stationLines: false // parse & expose lines of the station?
|
||||||
|
|
|
@ -11,7 +11,7 @@ With `opt`, you can override the default options, which look like this:
|
||||||
results: 8, // maximum number of results
|
results: 8, // maximum number of results
|
||||||
distance: null, // maximum walking distance in meters
|
distance: null, // maximum walking distance in meters
|
||||||
poi: false, // return points of interest?
|
poi: false, // return points of interest?
|
||||||
stations: true, // return stations?
|
stops: true, // return stops/stations?
|
||||||
stationLines: false, // parse & expose lines of the station?
|
stationLines: false, // parse & expose lines of the station?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const formatLocationFilter = (stations, addresses, poi) => {
|
const formatLocationFilter = (stops, addresses, poi) => {
|
||||||
if (stations && addresses && poi) return 'ALL'
|
if (stops && addresses && poi) return 'ALL'
|
||||||
return (stations ? 'S' : '') + (addresses ? 'A' : '') + (poi ? 'P' : '')
|
return (stops ? 'S' : '') + (addresses ? 'A' : '') + (poi ? 'P' : '')
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = formatLocationFilter
|
module.exports = formatLocationFilter
|
||||||
|
|
8
index.js
8
index.js
|
@ -297,13 +297,13 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
opt = Object.assign({
|
opt = Object.assign({
|
||||||
fuzzy: true, // find only exact matches?
|
fuzzy: true, // find only exact matches?
|
||||||
results: 5, // how many search results?
|
results: 5, // how many search results?
|
||||||
stations: true,
|
stops: true, // return stops/stations?
|
||||||
addresses: true,
|
addresses: true,
|
||||||
poi: true, // points of interest
|
poi: true, // points of interest
|
||||||
stationLines: false // parse & expose lines of the station?
|
stationLines: false // parse & expose lines of the station?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
const f = profile.formatLocationFilter(opt.stations, opt.addresses, opt.poi)
|
const f = profile.formatLocationFilter(opt.stops, opt.addresses, opt.poi)
|
||||||
return request(profile, userAgent, opt, {
|
return request(profile, userAgent, opt, {
|
||||||
cfg: {polyEnc: 'GPA'},
|
cfg: {polyEnc: 'GPA'},
|
||||||
meth: 'LocMatch',
|
meth: 'LocMatch',
|
||||||
|
@ -353,7 +353,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
results: 8, // maximum number of results
|
results: 8, // maximum number of results
|
||||||
distance: null, // maximum walking distance in meters
|
distance: null, // maximum walking distance in meters
|
||||||
poi: false, // return points of interest?
|
poi: false, // return points of interest?
|
||||||
stations: true, // return stations?
|
stops: true, // return stops/stations?
|
||||||
stationLines: false // parse & expose lines of the station?
|
stationLines: false // parse & expose lines of the station?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
minDist: 0
|
minDist: 0
|
||||||
},
|
},
|
||||||
getPOIs: !!opt.poi,
|
getPOIs: !!opt.poi,
|
||||||
getStops: !!opt.stations,
|
getStops: !!opt.stops,
|
||||||
maxLoc: opt.results
|
maxLoc: opt.results
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue