@furkot/directions 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -119,8 +119,8 @@ function getStatus(st, response) {
|
|
|
119
119
|
if (!(st || response)) {
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
response
|
|
123
|
-
response.status
|
|
122
|
+
response ??= {};
|
|
123
|
+
response.status ||= st;
|
|
124
124
|
// 401 Unauthorized, 429 Too Many Requests
|
|
125
125
|
if (st === 401 || st === 429) {
|
|
126
126
|
// we exceeded the limit
|
package/lib/service/index.js
CHANGED
|
@@ -190,8 +190,8 @@ export default function init(options) {
|
|
|
190
190
|
function avoidFeature(result, flag) {
|
|
191
191
|
const { query, req } = result;
|
|
192
192
|
if (query[flag]) {
|
|
193
|
-
req.options
|
|
194
|
-
req.options.avoid_features
|
|
193
|
+
req.options ??= {};
|
|
194
|
+
req.options.avoid_features ??= [];
|
|
195
195
|
req.options.avoid_features.push(avoidFeatures[flag]);
|
|
196
196
|
}
|
|
197
197
|
return result;
|
package/lib/service/util.js
CHANGED
|
@@ -49,13 +49,12 @@ export function isFuture(time) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// 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) {
|
|
54
53
|
return arr.filter(fn).join(conn);
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
export function last(arr) {
|
|
58
|
-
return arr
|
|
57
|
+
return arr.at(-1);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
export function split2object(str, conn, obj) {
|