Small preact-based (like React.js) project
https://inga-lovinde.github.io/static/komoot-demo/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
327 B
8 lines
327 B
import haversineDistance from 'haversine-distance';
|
|
import { toPairs } from './collections';
|
|
import { Waypoint } from './types';
|
|
|
|
export const getRouteLength = (points: Waypoint[]) =>
|
|
toPairs(points)
|
|
.map(([a, b]) => haversineDistance(a.coordinates, b.coordinates))
|
|
.reduce((sum, value) => sum + value, 0);
|
|
|