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/app/index.js
CHANGED
|
@@ -93,7 +93,6 @@ import {
|
|
|
93
93
|
flatMap as flatMap2,
|
|
94
94
|
flattenDeep,
|
|
95
95
|
flow,
|
|
96
|
-
isEqual,
|
|
97
96
|
groupBy,
|
|
98
97
|
head,
|
|
99
98
|
last,
|
|
@@ -420,7 +419,7 @@ function getAgencyGeoJSON(config2) {
|
|
|
420
419
|
// package.json
|
|
421
420
|
var package_default = {
|
|
422
421
|
name: "gtfs-to-html",
|
|
423
|
-
version: "2.10.
|
|
422
|
+
version: "2.10.14",
|
|
424
423
|
private: false,
|
|
425
424
|
description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
|
|
426
425
|
keywords: [
|
|
@@ -471,18 +470,18 @@ var package_default = {
|
|
|
471
470
|
anchorme: "^3.0.8",
|
|
472
471
|
archiver: "^7.0.1",
|
|
473
472
|
"cli-table": "^0.3.11",
|
|
474
|
-
"csv-stringify": "^6.
|
|
473
|
+
"csv-stringify": "^6.6.0",
|
|
475
474
|
express: "^5.1.0",
|
|
476
|
-
gtfs: "^4.17.
|
|
475
|
+
gtfs: "^4.17.5",
|
|
477
476
|
"gtfs-realtime-pbf-js-module": "^1.0.0",
|
|
478
477
|
"js-beautify": "^1.15.4",
|
|
479
478
|
"lodash-es": "^4.17.21",
|
|
480
|
-
marked: "^
|
|
479
|
+
marked: "^16.0.0",
|
|
481
480
|
moment: "^2.30.1",
|
|
482
481
|
pbf: "^4.0.1",
|
|
483
482
|
"pretty-error": "^4.0.0",
|
|
484
483
|
pug: "^3.0.3",
|
|
485
|
-
puppeteer: "^24.
|
|
484
|
+
puppeteer: "^24.14.0",
|
|
486
485
|
"sanitize-filename": "^1.6.3",
|
|
487
486
|
"sanitize-html": "^2.17.0",
|
|
488
487
|
sqlstring: "^2.3.3",
|
|
@@ -494,19 +493,19 @@ var package_default = {
|
|
|
494
493
|
},
|
|
495
494
|
devDependencies: {
|
|
496
495
|
"@types/archiver": "^6.0.3",
|
|
497
|
-
"@types/express": "^5.0.
|
|
496
|
+
"@types/express": "^5.0.3",
|
|
498
497
|
"@types/insane": "^1.0.0",
|
|
499
498
|
"@types/js-beautify": "^1.14.3",
|
|
500
499
|
"@types/lodash-es": "^4.17.12",
|
|
501
|
-
"@types/morgan": "^1.9.
|
|
502
|
-
"@types/node": "^22
|
|
500
|
+
"@types/morgan": "^1.9.10",
|
|
501
|
+
"@types/node": "^22",
|
|
503
502
|
"@types/pug": "^2.0.10",
|
|
504
503
|
"@types/sanitize-html": "^2.16.0",
|
|
505
504
|
"@types/timer-machine": "^1.1.3",
|
|
506
505
|
"@types/yargs": "^17.0.33",
|
|
507
506
|
husky: "^9.1.7",
|
|
508
|
-
"lint-staged": "^16.1.
|
|
509
|
-
prettier: "^3.
|
|
507
|
+
"lint-staged": "^16.1.2",
|
|
508
|
+
prettier: "^3.6.2",
|
|
510
509
|
tsup: "^8.5.0",
|
|
511
510
|
typescript: "^5.8.3"
|
|
512
511
|
},
|
|
@@ -576,37 +575,20 @@ var findCommonStopId = (trips, config2) => {
|
|
|
576
575
|
});
|
|
577
576
|
return commonStoptime ? commonStoptime.stop_id : null;
|
|
578
577
|
};
|
|
579
|
-
var deduplicateTrips = (trips
|
|
580
|
-
|
|
578
|
+
var deduplicateTrips = (trips) => {
|
|
579
|
+
if (trips.length <= 1) {
|
|
580
|
+
return trips;
|
|
581
|
+
}
|
|
582
|
+
const uniqueTrips = /* @__PURE__ */ new Map();
|
|
581
583
|
for (const trip of trips) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
const selectedStoptime = commonStopId ? find(trip.stoptimes, {
|
|
588
|
-
stop_id: commonStopId
|
|
589
|
-
}) : trip.stoptimes[0];
|
|
590
|
-
const similarTrips = deduplicatedTrips.filter((trip2) => {
|
|
591
|
-
const stoptime = find(trip2.stoptimes, {
|
|
592
|
-
stop_id: selectedStoptime?.stop_id
|
|
593
|
-
});
|
|
594
|
-
if (!stoptime) {
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
return stoptime.departure_time === selectedStoptime?.departure_time;
|
|
598
|
-
});
|
|
599
|
-
const tripIsUnique = every2(similarTrips, (similarTrip) => {
|
|
600
|
-
const similarTripStoptimes = similarTrip.stoptimes.map(
|
|
601
|
-
(stoptime) => stoptime.departure_time
|
|
602
|
-
);
|
|
603
|
-
return !isEqual(stoptimes, similarTripStoptimes);
|
|
604
|
-
});
|
|
605
|
-
if (tripIsUnique) {
|
|
606
|
-
deduplicatedTrips.push(trip);
|
|
584
|
+
const tripSignature = trip.stoptimes.map(
|
|
585
|
+
(stoptime) => `${stoptime.stop_id}|${stoptime.departure_time}|${stoptime.arrival_time}`
|
|
586
|
+
).join("|");
|
|
587
|
+
if (!uniqueTrips.has(tripSignature)) {
|
|
588
|
+
uniqueTrips.set(tripSignature, trip);
|
|
607
589
|
}
|
|
608
590
|
}
|
|
609
|
-
return
|
|
591
|
+
return Array.from(uniqueTrips.values());
|
|
610
592
|
};
|
|
611
593
|
var sortTrips = (trips, config2) => {
|
|
612
594
|
let sortedTrips;
|
|
@@ -660,7 +642,10 @@ var sortTrips = (trips, config2) => {
|
|
|
660
642
|
const lastStopId = last(longestTripStoptimes).stop_id;
|
|
661
643
|
sortedTrips = sortTripsByStoptimeAtStop(trips, lastStopId);
|
|
662
644
|
}
|
|
663
|
-
|
|
645
|
+
if (config2.showDuplicateTrips === false) {
|
|
646
|
+
return deduplicateTrips(sortedTrips ?? []);
|
|
647
|
+
}
|
|
648
|
+
return sortedTrips ?? [];
|
|
664
649
|
};
|
|
665
650
|
var sortTripsByStoptimeAtStop = (trips, stopId) => sortBy(trips, (trip) => {
|
|
666
651
|
const stoptime = find(trip.stoptimes, { stop_id: stopId });
|
|
@@ -1525,6 +1510,7 @@ function setDefaultConfig(initialConfig) {
|
|
|
1525
1510
|
serviceProvidedOnText: "Service provided on",
|
|
1526
1511
|
showArrivalOnDifference: 0.2,
|
|
1527
1512
|
showCalendarExceptions: true,
|
|
1513
|
+
showDuplicateTrips: false,
|
|
1528
1514
|
showMap: false,
|
|
1529
1515
|
showOnlyTimepoint: false,
|
|
1530
1516
|
showRouteTitle: true,
|