gtfs-to-html 2.10.13 → 2.10.14

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.
@@ -112,7 +112,6 @@ import {
112
112
  flatMap as flatMap2,
113
113
  flattenDeep,
114
114
  flow,
115
- isEqual,
116
115
  groupBy,
117
116
  head,
118
117
  last,
@@ -501,7 +500,7 @@ function formatTripNameForCSV(trip, timetable) {
501
500
  // package.json
502
501
  var package_default = {
503
502
  name: "gtfs-to-html",
504
- version: "2.10.13",
503
+ version: "2.10.14",
505
504
  private: false,
506
505
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
507
506
  keywords: [
@@ -552,18 +551,18 @@ var package_default = {
552
551
  anchorme: "^3.0.8",
553
552
  archiver: "^7.0.1",
554
553
  "cli-table": "^0.3.11",
555
- "csv-stringify": "^6.5.2",
554
+ "csv-stringify": "^6.6.0",
556
555
  express: "^5.1.0",
557
- gtfs: "^4.17.4",
556
+ gtfs: "^4.17.5",
558
557
  "gtfs-realtime-pbf-js-module": "^1.0.0",
559
558
  "js-beautify": "^1.15.4",
560
559
  "lodash-es": "^4.17.21",
561
- marked: "^15.0.12",
560
+ marked: "^16.0.0",
562
561
  moment: "^2.30.1",
563
562
  pbf: "^4.0.1",
564
563
  "pretty-error": "^4.0.0",
565
564
  pug: "^3.0.3",
566
- puppeteer: "^24.9.0",
565
+ puppeteer: "^24.14.0",
567
566
  "sanitize-filename": "^1.6.3",
568
567
  "sanitize-html": "^2.17.0",
569
568
  sqlstring: "^2.3.3",
@@ -575,19 +574,19 @@ var package_default = {
575
574
  },
576
575
  devDependencies: {
577
576
  "@types/archiver": "^6.0.3",
578
- "@types/express": "^5.0.2",
577
+ "@types/express": "^5.0.3",
579
578
  "@types/insane": "^1.0.0",
580
579
  "@types/js-beautify": "^1.14.3",
581
580
  "@types/lodash-es": "^4.17.12",
582
- "@types/morgan": "^1.9.9",
583
- "@types/node": "^22.15.24",
581
+ "@types/morgan": "^1.9.10",
582
+ "@types/node": "^22",
584
583
  "@types/pug": "^2.0.10",
585
584
  "@types/sanitize-html": "^2.16.0",
586
585
  "@types/timer-machine": "^1.1.3",
587
586
  "@types/yargs": "^17.0.33",
588
587
  husky: "^9.1.7",
589
- "lint-staged": "^16.1.0",
590
- prettier: "^3.5.3",
588
+ "lint-staged": "^16.1.2",
589
+ prettier: "^3.6.2",
591
590
  tsup: "^8.5.0",
592
591
  typescript: "^5.8.3"
593
592
  },
@@ -657,37 +656,20 @@ var findCommonStopId = (trips, config) => {
657
656
  });
658
657
  return commonStoptime ? commonStoptime.stop_id : null;
659
658
  };
660
- var deduplicateTrips = (trips, commonStopId) => {
661
- const deduplicatedTrips = [];
659
+ var deduplicateTrips = (trips) => {
660
+ if (trips.length <= 1) {
661
+ return trips;
662
+ }
663
+ const uniqueTrips = /* @__PURE__ */ new Map();
662
664
  for (const trip of trips) {
663
- if (deduplicatedTrips.length === 0 || trip.stoptimes.length === 0) {
664
- deduplicatedTrips.push(trip);
665
- continue;
666
- }
667
- const stoptimes = trip.stoptimes.map((stoptime) => stoptime.departure_time);
668
- const selectedStoptime = commonStopId ? find(trip.stoptimes, {
669
- stop_id: commonStopId
670
- }) : trip.stoptimes[0];
671
- const similarTrips = deduplicatedTrips.filter((trip2) => {
672
- const stoptime = find(trip2.stoptimes, {
673
- stop_id: selectedStoptime?.stop_id
674
- });
675
- if (!stoptime) {
676
- return false;
677
- }
678
- return stoptime.departure_time === selectedStoptime?.departure_time;
679
- });
680
- const tripIsUnique = every2(similarTrips, (similarTrip) => {
681
- const similarTripStoptimes = similarTrip.stoptimes.map(
682
- (stoptime) => stoptime.departure_time
683
- );
684
- return !isEqual(stoptimes, similarTripStoptimes);
685
- });
686
- if (tripIsUnique) {
687
- deduplicatedTrips.push(trip);
665
+ const tripSignature = trip.stoptimes.map(
666
+ (stoptime) => `${stoptime.stop_id}|${stoptime.departure_time}|${stoptime.arrival_time}`
667
+ ).join("|");
668
+ if (!uniqueTrips.has(tripSignature)) {
669
+ uniqueTrips.set(tripSignature, trip);
688
670
  }
689
671
  }
690
- return deduplicatedTrips;
672
+ return Array.from(uniqueTrips.values());
691
673
  };
692
674
  var sortTrips = (trips, config) => {
693
675
  let sortedTrips;
@@ -741,7 +723,10 @@ var sortTrips = (trips, config) => {
741
723
  const lastStopId = last(longestTripStoptimes).stop_id;
742
724
  sortedTrips = sortTripsByStoptimeAtStop(trips, lastStopId);
743
725
  }
744
- return deduplicateTrips(sortedTrips, commonStopId);
726
+ if (config.showDuplicateTrips === false) {
727
+ return deduplicateTrips(sortedTrips ?? []);
728
+ }
729
+ return sortedTrips ?? [];
745
730
  };
746
731
  var sortTripsByStoptimeAtStop = (trips, stopId) => sortBy(trips, (trip) => {
747
732
  const stoptime = find(trip.stoptimes, { stop_id: stopId });
@@ -1606,6 +1591,7 @@ function setDefaultConfig(initialConfig) {
1606
1591
  serviceProvidedOnText: "Service provided on",
1607
1592
  showArrivalOnDifference: 0.2,
1608
1593
  showCalendarExceptions: true,
1594
+ showDuplicateTrips: false,
1609
1595
  showMap: false,
1610
1596
  showOnlyTimepoint: false,
1611
1597
  showRouteTitle: true,