File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ if (typeof (fetch) === 'undefined') require('isomorphic-fetch')
8
8
import { queryIsValid } from '../util/state'
9
9
import queryParams from '../util/query-params'
10
10
import { updateOtpUrlParams } from '../util/query'
11
+ import { hasCar } from '../util/itinerary'
11
12
12
13
// Generic API actions
13
14
@@ -123,8 +124,8 @@ function constructRoutingQuery (otpState, ignoreRealtimeUpdates) {
123
124
}
124
125
}
125
126
126
- // hack to add walking to driving, TNC trips, bicycling
127
- if ( ! params . mode . includes ( 'WALK' ) ) {
127
+ // hack to add walking to driving/ TNC trips
128
+ if ( hasCar ( params . mode ) ) {
128
129
params . mode += ',WALK'
129
130
}
130
131
Original file line number Diff line number Diff line change @@ -21,11 +21,17 @@ export function isTransit (mode) {
21
21
* @return {boolean } whether any of the modes are transit modes
22
22
*/
23
23
export function hasTransit ( modesStr ) {
24
- let result = false
25
- modesStr . split ( ',' ) . forEach ( mode => {
26
- if ( isTransit ( mode ) ) result = true
27
- } )
28
- return result
24
+ modesStr . split ( ',' ) . forEach ( mode => { if ( isTransit ( mode ) ) return true } )
25
+ return false
26
+ }
27
+
28
+ /**
29
+ * @param {string } modesStr a comma-separated list of OTP modes
30
+ * @return {boolean } whether any of the modes are car-based modes
31
+ */
32
+ export function hasCar ( modesStr ) {
33
+ modesStr . split ( ',' ) . forEach ( mode => { if ( isCar ( mode ) ) return true } )
34
+ return false
29
35
}
30
36
31
37
export function isWalk ( mode ) {
You can’t perform that action at this time.
0 commit comments