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