src/format.js
+14
6 unmodified lines7891011121314151617181920212223More unchanged context may be available6 unmodified lines const m = Math.round(minutes % 60); return h ? `${h} h ${m} min` : `${m} min`;}
// Profile entries are elevations in meters, in trail order.export function elevationGainM(profile) { let gain = 0; for (let i = 1; i < profile.length; i++) { gain += Math.max(0, profile[i] - profile[i - 1]); } return gain;}
// Trails provide distanceM, durationMin and an elevationProfile in meters.export function trailSummary(trail) { return `${formatDistanceKm(trail.distanceM)} · ${formatDuration(trail.durationMin)} · ${elevationGainM(trail.elevationProfile)} m gain`;}More unchanged context may be availabletest/format.test.js
-1+28