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