minotor 7.0.0 → 7.0.2
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.
- package/CHANGELOG.md +2 -7
- package/dist/cli.mjs +54 -46
- package/dist/cli.mjs.map +1 -1
- package/dist/parser.cjs.js +49 -42
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.esm.js +49 -42
- package/dist/parser.esm.js.map +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.esm.js +1 -1
- package/dist/router.esm.js.map +1 -1
- package/dist/router.umd.js +1 -1
- package/dist/router.umd.js.map +1 -1
- package/dist/routing/router.d.ts +1 -1
- package/package.json +1 -1
- package/src/routing/router.ts +8 -6
- package/src/timetable/route.ts +23 -22
- package/src/timetable/time.ts +23 -9
- package/src/timetable/timetable.ts +1 -3
package/dist/parser.esm.js
CHANGED
|
@@ -22,18 +22,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
22
22
|
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
function __rest(s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
38
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12782,9 +12770,16 @@ class Time {
|
|
|
12782
12770
|
if (times.length === 0) {
|
|
12783
12771
|
throw new Error('At least one Time instance is required.');
|
|
12784
12772
|
}
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12773
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12774
|
+
let maxTime = times[0];
|
|
12775
|
+
for (let i = 1; i < times.length; i++) {
|
|
12776
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12777
|
+
if (times[i].minutesSinceMidnight > maxTime.minutesSinceMidnight) {
|
|
12778
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12779
|
+
maxTime = times[i];
|
|
12780
|
+
}
|
|
12781
|
+
}
|
|
12782
|
+
return maxTime;
|
|
12788
12783
|
}
|
|
12789
12784
|
/**
|
|
12790
12785
|
* Computes the minimum Time instance among the provided Time instances.
|
|
@@ -12796,9 +12791,16 @@ class Time {
|
|
|
12796
12791
|
if (times.length === 0) {
|
|
12797
12792
|
throw new Error('At least one Time instance is required.');
|
|
12798
12793
|
}
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12794
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12795
|
+
let minTime = times[0];
|
|
12796
|
+
for (let i = 1; i < times.length; i++) {
|
|
12797
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12798
|
+
if (times[i].minutesSinceMidnight < minTime.minutesSinceMidnight) {
|
|
12799
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12800
|
+
minTime = times[i];
|
|
12801
|
+
}
|
|
12802
|
+
}
|
|
12803
|
+
return minTime;
|
|
12802
12804
|
}
|
|
12803
12805
|
/**
|
|
12804
12806
|
* Determines if the current Time instance is after another Time instance.
|
|
@@ -12807,7 +12809,7 @@ class Time {
|
|
|
12807
12809
|
* @returns True if the current Time instance is after the other Time instance, otherwise false.
|
|
12808
12810
|
*/
|
|
12809
12811
|
isAfter(otherTime) {
|
|
12810
|
-
return this.minutesSinceMidnight > otherTime.
|
|
12812
|
+
return this.minutesSinceMidnight > otherTime.minutesSinceMidnight;
|
|
12811
12813
|
}
|
|
12812
12814
|
/**
|
|
12813
12815
|
* Determines if the current Time instance is before another Time instance.
|
|
@@ -12816,7 +12818,7 @@ class Time {
|
|
|
12816
12818
|
* @returns True if the current Time instance is before the other Time instance, otherwise false.
|
|
12817
12819
|
*/
|
|
12818
12820
|
isBefore(otherTime) {
|
|
12819
|
-
return this.minutesSinceMidnight < otherTime.
|
|
12821
|
+
return this.minutesSinceMidnight < otherTime.minutesSinceMidnight;
|
|
12820
12822
|
}
|
|
12821
12823
|
/**
|
|
12822
12824
|
* Determines if the current Time instance is equal to another Time instance.
|
|
@@ -12825,7 +12827,7 @@ class Time {
|
|
|
12825
12827
|
* @returns True if the current Time instance is equal to the other Time instance, otherwise false.
|
|
12826
12828
|
*/
|
|
12827
12829
|
equals(otherTime) {
|
|
12828
|
-
return this.minutesSinceMidnight === otherTime.
|
|
12830
|
+
return this.minutesSinceMidnight === otherTime.minutesSinceMidnight;
|
|
12829
12831
|
}
|
|
12830
12832
|
}
|
|
12831
12833
|
|
|
@@ -13002,29 +13004,35 @@ class Route {
|
|
|
13002
13004
|
* @returns The index of the earliest trip meeting the criteria, or undefined if no such trip is found.
|
|
13003
13005
|
*/
|
|
13004
13006
|
findEarliestTrip(stopId, after = Time.origin(), beforeTrip) {
|
|
13005
|
-
|
|
13006
|
-
? Math.min(beforeTrip - 1, this.nbTrips - 1)
|
|
13007
|
-
: this.nbTrips - 1;
|
|
13008
|
-
if (maxTripIndex < 0) {
|
|
13007
|
+
if (this.nbTrips <= 0)
|
|
13009
13008
|
return undefined;
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13009
|
+
let hi = this.nbTrips - 1;
|
|
13010
|
+
if (beforeTrip !== undefined)
|
|
13011
|
+
hi = Math.min(hi, beforeTrip - 1);
|
|
13012
|
+
if (hi < 0)
|
|
13013
|
+
return undefined;
|
|
13014
|
+
let lo = 0;
|
|
13015
|
+
let lb = -1;
|
|
13016
|
+
while (lo <= hi) {
|
|
13017
|
+
const mid = (lo + hi) >>> 1;
|
|
13018
|
+
const depMid = this.departureFrom(stopId, mid);
|
|
13019
|
+
if (depMid.isBefore(after)) {
|
|
13020
|
+
lo = mid + 1;
|
|
13022
13021
|
}
|
|
13023
13022
|
else {
|
|
13024
|
-
|
|
13023
|
+
lb = mid;
|
|
13024
|
+
hi = mid - 1;
|
|
13025
13025
|
}
|
|
13026
13026
|
}
|
|
13027
|
-
|
|
13027
|
+
if (lb === -1)
|
|
13028
|
+
return undefined;
|
|
13029
|
+
for (let t = lb; t < (beforeTrip !== null && beforeTrip !== void 0 ? beforeTrip : this.nbTrips); t++) {
|
|
13030
|
+
const pickup = this.pickUpTypeFrom(stopId, t);
|
|
13031
|
+
if (pickup !== 'NOT_AVAILABLE') {
|
|
13032
|
+
return t;
|
|
13033
|
+
}
|
|
13034
|
+
}
|
|
13035
|
+
return undefined;
|
|
13028
13036
|
}
|
|
13029
13037
|
/**
|
|
13030
13038
|
* Retrieves the index of a stop within the route.
|
|
@@ -13259,6 +13267,7 @@ const serializeRouteType = (type) => {
|
|
|
13259
13267
|
}
|
|
13260
13268
|
};
|
|
13261
13269
|
|
|
13270
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
13262
13271
|
const ALL_TRANSPORT_MODES = new Set([
|
|
13263
13272
|
'TRAM',
|
|
13264
13273
|
'SUBWAY',
|
|
@@ -13363,9 +13372,7 @@ class Timetable {
|
|
|
13363
13372
|
if (!serviceRoute) {
|
|
13364
13373
|
throw new Error(`Service route not found for route ID: ${route.serviceRoute()}`);
|
|
13365
13374
|
}
|
|
13366
|
-
|
|
13367
|
-
const { routes } = serviceRoute, serviceRouteInfo = __rest(serviceRoute, ["routes"]);
|
|
13368
|
-
return serviceRouteInfo;
|
|
13375
|
+
return { type: serviceRoute.type, name: serviceRoute.name };
|
|
13369
13376
|
}
|
|
13370
13377
|
/**
|
|
13371
13378
|
* Finds all routes passing through a stop.
|