gtfs-to-html 2.9.14 → 2.10.0

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.
@@ -331,7 +331,7 @@ function formatTripNameForCSV(trip, timetable) {
331
331
  }
332
332
 
333
333
  // package.json
334
- var version = "2.9.14";
334
+ var version = "2.10.0";
335
335
 
336
336
  // src/lib/utils.ts
337
337
  var isTimepoint = (stoptime) => {
@@ -385,12 +385,12 @@ var deduplicateTrips = (trips, commonStopId) => {
385
385
  }) : trip.stoptimes[0];
386
386
  const similarTrips = deduplicatedTrips.filter((trip2) => {
387
387
  const stoptime = find(trip2.stoptimes, {
388
- stop_id: selectedStoptime.stop_id
388
+ stop_id: selectedStoptime?.stop_id
389
389
  });
390
390
  if (!stoptime) {
391
391
  return false;
392
392
  }
393
- return stoptime.departure_time === selectedStoptime.departure_time;
393
+ return stoptime.departure_time === selectedStoptime?.departure_time;
394
394
  });
395
395
  const tripIsUnique = every2(similarTrips, (similarTrip) => {
396
396
  const similarTripStoptimes = similarTrip.stoptimes.map(
@@ -422,8 +422,10 @@ var sortTrips = (trips, config) => {
422
422
  if (trip.stoptimes.length === 0) {
423
423
  continue;
424
424
  }
425
- trip.firstStoptime = timeToSeconds(first(trip.stoptimes).departure_time);
426
- trip.lastStoptime = timeToSeconds(last(trip.stoptimes).departure_time);
425
+ trip.firstStoptime = timeToSeconds(trip.stoptimes[0].departure_time);
426
+ trip.lastStoptime = timeToSeconds(
427
+ trip.stoptimes[trip.stoptimes.length - 1].departure_time
428
+ );
427
429
  }
428
430
  sortedTrips = sortBy(
429
431
  trips,
@@ -435,8 +437,10 @@ var sortTrips = (trips, config) => {
435
437
  if (trip.stoptimes.length === 0) {
436
438
  continue;
437
439
  }
438
- trip.firstStoptime = timeToSeconds(first(trip.stoptimes).departure_time);
439
- trip.lastStoptime = timeToSeconds(last(trip.stoptimes).departure_time);
440
+ trip.firstStoptime = timeToSeconds(trip.stoptimes[0].departure_time);
441
+ trip.lastStoptime = timeToSeconds(
442
+ trip.stoptimes[trip.stoptimes.length - 1].departure_time
443
+ );
440
444
  }
441
445
  sortedTrips = sortBy(
442
446
  trips,
@@ -502,8 +506,8 @@ var getDaysFromCalendars = (calendars) => {
502
506
  sunday: 0
503
507
  };
504
508
  for (const calendar of calendars) {
505
- for (const [day, value] of Object.entries(days2)) {
506
- days2[day] = value | calendar[day];
509
+ for (const day of Object.keys(days2)) {
510
+ days2[day] = days2[day] | calendar[day];
507
511
  }
508
512
  }
509
513
  return days2;
@@ -778,20 +782,27 @@ var getStopOrder = (timetable, config) => {
778
782
  stopGraph.push([stopId, sortedStopIds[index + 1]]);
779
783
  }
780
784
  }
781
- const stopIds2 = toposort(stopGraph);
785
+ const stopIds = toposort(stopGraph);
782
786
  return duplicateStopsForDifferentArrivalDeparture(
783
- stopIds2,
787
+ stopIds,
784
788
  timetable,
785
789
  config
786
790
  );
787
791
  } catch {
792
+ const longestTripStoptimes = getLongestTripStoptimes(
793
+ timetable.orderedTrips,
794
+ config
795
+ );
796
+ const stopIds = longestTripStoptimes.map((stoptime) => stoptime.stop_id);
797
+ config.logWarning(
798
+ `Timetable ${timetable.timetable_id} stops are unable to be topologically sorted and has no \`timetable_stop_order.txt\`. Falling back to using the using the stop order from trip with most stoptimes, but this can result in timetables with some stops missing. Try manually specifying stops with \`timetable_stop_order.txt\`.`
799
+ );
800
+ return duplicateStopsForDifferentArrivalDeparture(
801
+ stopIds,
802
+ timetable,
803
+ config
804
+ );
788
805
  }
789
- const longestTripStoptimes = getLongestTripStoptimes(
790
- timetable.orderedTrips,
791
- config
792
- );
793
- const stopIds = longestTripStoptimes.map((stoptime) => stoptime.stop_id);
794
- return duplicateStopsForDifferentArrivalDeparture(stopIds, timetable, config);
795
806
  };
796
807
  var getStopsForTimetable = (timetable, config) => {
797
808
  if (timetable.orderedTrips.length === 0) {
@@ -1274,6 +1285,7 @@ function setDefaultConfig(initialConfig) {
1274
1285
  interpolatedStopText: "Estimated time of arrival",
1275
1286
  gtfsToHtmlVersion: version,
1276
1287
  linkStopUrls: false,
1288
+ mapStyleUrl: "https://tiles.openfreemap.org/styles/liberty",
1277
1289
  menuType: "jump",
1278
1290
  noDropoffSymbol: "\u2021",
1279
1291
  noDropoffText: "No drop off available",