You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

gtfs-to-html

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtfs-to-html - npm Package Compare versions

Comparing version

to
0.13.8

@@ -5,11 +5,10 @@ const _ = require('lodash');

function parseTime(timeStr) {
let hr = parseInt(timeStr.substr(0, timeStr.indexOf(':')), 10);
// Convert time string into a moment less than 24 hours
const duration = moment.duration(timeStr);
// Decrement time past 23 hours so moment can parse it
while (hr > 23) {
hr -= 24;
}
timeStr = `${hr}:${timeStr.substr(timeStr.indexOf(':'))}`;
return moment(timeStr, 'HH:mm:ss');
return moment({
hour: duration.hours(),
minute: duration.minutes(),
second: duration.seconds()
});
}

@@ -21,4 +20,4 @@

function updateTimeByOffset(time, offsetSeconds) {
const newTime = parseTime(time);
function updateTimeByOffset(timeStr, offsetSeconds) {
const newTime = parseTime(timeStr);
return stringifyTime(newTime.add(offsetSeconds, 'seconds'));

@@ -56,7 +55,7 @@ }

exports.secondsAfterMidnight = timeStr => {
return parseTime(timeStr).diff(parseTime('00:00:00'), 'seconds');
return moment.duration(timeStr).asSeconds();
};
function minutesAfterMidnight(timeStr) {
return parseTime(timeStr).diff(parseTime('00:00:00'), 'minutes');
return moment.duration(timeStr).asMinutes();
}

@@ -63,0 +62,0 @@

@@ -461,2 +461,7 @@ const _ = require('lodash');

// Set default filename
if (!timetablePage.filename) {
timetablePage.filename = `${timetablePage.timetable_page_id}.html`;
}
// Get direction_name for each timetable

@@ -500,3 +505,3 @@ await Promise.all(timetablePage.timetables.map(async timetable => {

// Check if there are any timetable pages
// Check if there are any timetable pages defined in timetable_pages.txt
const timetablePages = await gtfs.getTimetablePages({

@@ -551,3 +556,3 @@ agency_key: agencyKey,

} else {
// Otherwise, use timetablepage provided
// Otherwise, use timetablepage defined in timetable_pages.txt
timetablePage = _.first(timetablePages);

@@ -568,3 +573,3 @@ timetablePage.timetables = await filterAndSortTimetables(timetables, timetablePage.timetable_page_id);

// Check if there are any timetable pages
// Check if there are any timetable pages defined in timetable_pages.txt
let timetablePages = await gtfs.getTimetablePages({agency_key: agencyKey});

@@ -579,3 +584,3 @@

} else {
// Otherwise, use timetable pages provided
// Otherwise, use timetable pages defined in timetable_pages.txt
timetablePages = await Promise.all(timetablePages.map(async timetablePage => {

@@ -582,0 +587,0 @@ timetablePage.timetables = await filterAndSortTimetables(timetables, timetablePage.timetable_page_id);

{
"name": "gtfs-to-html",
"description": "Build transit timetables in HTML from a GTFS file",
"version": "0.13.7",
"version": "0.13.8",
"keywords": [

@@ -39,7 +39,7 @@ "transit",

"fs-extra": "^5.0.0",
"gtfs": "1.5.0",
"gtfs": "1.5.1",
"js-beautify": "^1.7.5",
"lodash": "^4.17.5",
"moment": "^2.20.1",
"mongoose": "5.0.3",
"mongoose": "5.0.6",
"morgan": "^1.9.0",

@@ -54,3 +54,3 @@ "pug": "^2.0.0-rc.4",

"devDependencies": {
"xo": "^0.18.2"
"xo": "^0.20.3"
},

@@ -57,0 +57,0 @@ "engines": {

@@ -358,3 +358,3 @@ # GTFS to HTML

| `timetable_page_label` | A label that will show up on the top of the page. Optional, defaults to using route name. |
| `filename` | The filename to use for the generated HTML file. |
| `filename` | The filename to use for the generated HTML file. Optional, defaults to `timetable_page_id` with file extension `.html`, for example `1.html`. |

@@ -361,0 +361,0 @@ ## Running

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet