- get the distance between two points
- get the distance between a list of points
npm install calculate-distance-between-coordinates
yarn add calculate-distance-between-coordinates
function getDistanceBetweenTwoPoints(
cord1: Coordinate,
cord2: Coordinate,
unit: Unit = 'km',
): number
export function getTotalDistance(
coordinates: Coordinate[],
unit: Unit = "km"
): number
type Coordinate = {
lat: number;
lon: number;
};
type Unit = 'km' | 'mile';