Skip to content

Commit 1f3eeeb

Browse files
committed
Merge remote-tracking branch 'origin/minor-fixes'
2 parents 111d8a3 + 386d030 commit 1f3eeeb

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

lib/service/graphhopper/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ function getStatus(st, response) {
119119
if (!(st || response)) {
120120
return;
121121
}
122-
response = response || {};
123-
response.status = response.status || st;
122+
response ??= {};
123+
response.status ||= st;
124124
// 401 Unauthorized, 429 Too Many Requests
125125
if (st === 401 || st === 429) {
126126
// we exceeded the limit

lib/service/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function init(options) {
4444
throw ERROR;
4545
}
4646

47-
query.path = query.path || pathType.none;
47+
query.path ||= pathType.none;
4848
let req = options.prepareRequest(query);
4949
if (!req) {
5050
return;

lib/service/mapquest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default function init(options) {
130130
req.avoids = ['Limited Access'];
131131
}
132132
if (query.avoidTolls) {
133-
req.avoids = req.avoids || [];
133+
req.avoids ??= [];
134134
req.avoids.push('Toll Road');
135135
}
136136
if (query.begin) {

lib/service/openroute/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ export default function init(options) {
190190
function avoidFeature(result, flag) {
191191
const { query, req } = result;
192192
if (query[flag]) {
193-
req.options = req.options || {};
194-
req.options.avoid_features = req.options.avoid_features || [];
193+
req.options ??= {};
194+
req.options.avoid_features ??= [];
195195
req.options.avoid_features.push(avoidFeatures[flag]);
196196
}
197197
return result;

lib/service/util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ export function isFuture(time) {
4949
}
5050

5151
// like normal join but with optional filter fn
52-
export function join(arr, conn, fn) {
53-
fn = fn || (it => it);
52+
export function join(arr, conn, fn = it => it) {
5453
return arr.filter(fn).join(conn);
5554
}
5655

5756
export function last(arr) {
58-
return arr[arr.length - 1];
57+
return arr.at(-1);
5958
}
6059

6160
export function split2object(str, conn, obj) {

0 commit comments

Comments
 (0)