furkot-driving-log
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -8,2 +8,7 @@ var buffer = require('./buffer'); | ||
var zero = { | ||
distance: 0, | ||
driving: 0 | ||
}; | ||
function write(out, line) { | ||
@@ -52,9 +57,9 @@ line = line.map(function(item) { | ||
'Notes' | ||
]; | ||
], | ||
mode = options.metadata && options.metadata.mode; | ||
write(out, header); | ||
options.routes[0].points.forEach(function (step, i, steps) { | ||
var line = [], next = steps[i + 1]; | ||
var line = [], next = steps[i + 1], travel; | ||
if (!next) { | ||
@@ -69,4 +74,10 @@ return; | ||
totals.driving += next.driving; | ||
totals.distance += next.distance; | ||
if (mode === next.mode || next.mode === undefined) { | ||
travel = next; | ||
} | ||
else { | ||
travel = zero; | ||
} | ||
totals.driving += travel.driving; | ||
totals.distance += travel.distance; | ||
@@ -81,4 +92,4 @@ line.push(step.name); | ||
line.push(format.time(next.arrival_time)); | ||
line.push(format.duration(next.driving)); | ||
line.push(format.distance(next.distance, 1, distanceUnit)); | ||
line.push(format.duration(travel.driving)); | ||
line.push(format.distance(travel.distance, 1, distanceUnit)); | ||
line.push(format.duration(totals.driving)); | ||
@@ -85,0 +96,0 @@ line.push(format.distance(totals.distance, 1, distanceUnit)); |
{ | ||
"name": "furkot-driving-log", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Generate CSV driving log from Furkot trip data.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://trips.furkot.com", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6408
12
150
0