minotor 7.0.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
- ## [7.0.1](https://github.com/aubryio/minotor/compare/v7.0.0...v7.0.1) (2025-09-23)
1
+ ## [7.0.2](https://github.com/aubryio/minotor/compare/v7.0.1...v7.0.2) (2025-09-23)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Performance Improvements
5
5
 
6
- * address corner cases with boarding conditions ([#27](https://github.com/aubryio/minotor/issues/27)) ([cd5fe68](https://github.com/aubryio/minotor/commit/cd5fe682ca359872a6bac46dbdc30ec9d603c8ef))
6
+ * minor perf improvements ([#28](https://github.com/aubryio/minotor/issues/28)) ([8bd3150](https://github.com/aubryio/minotor/commit/8bd3150669c6d7abee2f2c5759fb0946f3cb509f))
package/dist/cli.mjs CHANGED
@@ -30,18 +30,6 @@ PERFORMANCE OF THIS SOFTWARE.
30
30
  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
31
31
 
32
32
 
33
- function __rest(s, e) {
34
- var t = {};
35
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
36
- t[p] = s[p];
37
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
38
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
39
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
40
- t[p[i]] = s[p[i]];
41
- }
42
- return t;
43
- }
44
-
45
33
  function __awaiter(thisArg, _arguments, P, generator) {
46
34
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
35
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -17094,9 +17082,16 @@ class Time {
17094
17082
  if (times.length === 0) {
17095
17083
  throw new Error('At least one Time instance is required.');
17096
17084
  }
17097
- return times.reduce((maxTime, currentTime) => {
17098
- return currentTime.isAfter(maxTime) ? currentTime : maxTime;
17099
- });
17085
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17086
+ let maxTime = times[0];
17087
+ for (let i = 1; i < times.length; i++) {
17088
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17089
+ if (times[i].minutesSinceMidnight > maxTime.minutesSinceMidnight) {
17090
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17091
+ maxTime = times[i];
17092
+ }
17093
+ }
17094
+ return maxTime;
17100
17095
  }
17101
17096
  /**
17102
17097
  * Computes the minimum Time instance among the provided Time instances.
@@ -17108,9 +17103,16 @@ class Time {
17108
17103
  if (times.length === 0) {
17109
17104
  throw new Error('At least one Time instance is required.');
17110
17105
  }
17111
- return times.reduce((minTime, currentTime) => {
17112
- return currentTime.isBefore(minTime) ? currentTime : minTime;
17113
- });
17106
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17107
+ let minTime = times[0];
17108
+ for (let i = 1; i < times.length; i++) {
17109
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17110
+ if (times[i].minutesSinceMidnight < minTime.minutesSinceMidnight) {
17111
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17112
+ minTime = times[i];
17113
+ }
17114
+ }
17115
+ return minTime;
17114
17116
  }
17115
17117
  /**
17116
17118
  * Determines if the current Time instance is after another Time instance.
@@ -17119,7 +17121,7 @@ class Time {
17119
17121
  * @returns True if the current Time instance is after the other Time instance, otherwise false.
17120
17122
  */
17121
17123
  isAfter(otherTime) {
17122
- return this.minutesSinceMidnight > otherTime.toMinutes();
17124
+ return this.minutesSinceMidnight > otherTime.minutesSinceMidnight;
17123
17125
  }
17124
17126
  /**
17125
17127
  * Determines if the current Time instance is before another Time instance.
@@ -17128,7 +17130,7 @@ class Time {
17128
17130
  * @returns True if the current Time instance is before the other Time instance, otherwise false.
17129
17131
  */
17130
17132
  isBefore(otherTime) {
17131
- return this.minutesSinceMidnight < otherTime.toMinutes();
17133
+ return this.minutesSinceMidnight < otherTime.minutesSinceMidnight;
17132
17134
  }
17133
17135
  /**
17134
17136
  * Determines if the current Time instance is equal to another Time instance.
@@ -17137,7 +17139,7 @@ class Time {
17137
17139
  * @returns True if the current Time instance is equal to the other Time instance, otherwise false.
17138
17140
  */
17139
17141
  equals(otherTime) {
17140
- return this.minutesSinceMidnight === otherTime.toMinutes();
17142
+ return this.minutesSinceMidnight === otherTime.minutesSinceMidnight;
17141
17143
  }
17142
17144
  }
17143
17145
 
@@ -17577,6 +17579,7 @@ const serializeRouteType = (type) => {
17577
17579
  }
17578
17580
  };
17579
17581
 
17582
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
17580
17583
  const ALL_TRANSPORT_MODES = new Set([
17581
17584
  'TRAM',
17582
17585
  'SUBWAY',
@@ -17681,9 +17684,7 @@ class Timetable {
17681
17684
  if (!serviceRoute) {
17682
17685
  throw new Error(`Service route not found for route ID: ${route.serviceRoute()}`);
17683
17686
  }
17684
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
17685
- const { routes } = serviceRoute, serviceRouteInfo = __rest(serviceRoute, ["routes"]);
17686
- return serviceRouteInfo;
17687
+ return { type: serviceRoute.type, name: serviceRoute.name };
17687
17688
  }
17688
17689
  /**
17689
17690
  * Finds all routes passing through a stop.
@@ -20939,6 +20940,7 @@ class Router {
20939
20940
  // together with corresponding hop on stop index (earliest marked stop)
20940
20941
  const reachableRoutes = this.timetable.findReachableRoutes(markedStops, options.transportModes);
20941
20942
  markedStops.clear();
20943
+ const earliestArrivalAtAnyDestination = this.earliestArrivalAtAnyStop(earliestArrivals, destinations);
20942
20944
  // for each route that can be reached with at least round - 1 trips
20943
20945
  const reachableRoutesArray = Array.from(reachableRoutes.entries());
20944
20946
  for (let i = 0; i < reachableRoutesArray.length; i++) {
@@ -20955,7 +20957,7 @@ class Router {
20955
20957
  const earliestArrivalAtCurrentStop = (_b = (_a = earliestArrivals.get(currentStop)) === null || _a === void 0 ? void 0 : _a.arrival) !== null && _b !== void 0 ? _b : UNREACHED;
20956
20958
  if (currentDropOffType !== 'NOT_AVAILABLE' &&
20957
20959
  currentArrivalTime.isBefore(earliestArrivalAtCurrentStop) &&
20958
- currentArrivalTime.isBefore(this.earliestArrivalAtAnyStop(earliestArrivals, destinations))) {
20960
+ currentArrivalTime.isBefore(earliestArrivalAtAnyDestination)) {
20959
20961
  const bestHopOnDepartureTime = route.departureFrom(currentTrip.bestHopOnStop, currentTrip.tripIndex);
20960
20962
  arrivalsAtCurrentRound.set(currentStop, {
20961
20963
  arrival: currentArrivalTime,