UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

17 lines (16 loc) 595 B
/** * Calculates the distance between two geographic coordinates using the Haversine formula. * @param point1 - First geographic coordinate with `lat` and `lon` properties. * @param point2 - Second geographic coordinate with `lat` and `lon` properties. * @returns The distance between the two coordinates in kilometers. * * @example * getDistanceBetweenPoints({ lat: 51.5074, lon: 0.1278 }, { lat: 48.8566, lon: 2.3522 }); // 343.5 */ export default function getDistanceBetweenPoints(point1: { lat: number; lon: number; }, point2: { lat: number; lon: number; }): number;