Skip to content

[DRAFT] feat: getGeoDiff#40

Draft
DoneDeal0 wants to merge 1 commit intomainfrom
getgeodiff
Draft

[DRAFT] feat: getGeoDiff#40
DoneDeal0 wants to merge 1 commit intomainfrom
getgeodiff

Conversation

@DoneDeal0
Copy link
Owner

🌎 NEW FEATURE: getGeoDiff

import { getGeoDiff } from "@donedeal0/superdiff";

Compares two coordinates and returns the distance between them.

FORMAT

Input

previousCoordinates: GeoCoordinates | null | undefined;
coordinates: GeoCoordinates | null | undefined;
options?: {
   unit:? "centimeters" | "feet" | "inches" |"kilometers" | "meters" | "miles" | "scandinavian miles" | "millimeters" | "yards".
   accuracy?: "normal" | "high", // "normal" by default
   maxDecimals?: number;
   locale?: Intl.Locale | string // undefined by default
* @param {GeoCoordinates | null | undefined} previousCoordinates - The original coordinates.
 * @param {GeoCoordinates | null | undefined} coordinates - The current or target coordinates.
 * @param {TextDiffOptions} options - Options to refine your output.
  - `unit`: centimeters, feet, inches, kilometers, meters, miles, scandinavian miles, millimeters or yards.
  - `accuracy`: 
    - `normal` (default): fastest mode, with a small error margin, based on Haversine formula.
    - `high`: slower but exact distance. Based on vincenty formula.
  - `maxDecimals`: maximal decimals for the distance. Defaults to 2.
  - `locale`: the locale of your distance. Enables a locale‑aware distance label.

Output

export type GeoDiff = {
    type: "geo";
    status: GeoStatus;
    diff: {
        coordinates: GeoCoordinates | null;
        previousCoordinates: GeoCoordinates | null;
        distance: number;
        unit: GeoUnit,
        label: string,
        direction: GeoDirection;
    };
};

@DoneDeal0 DoneDeal0 changed the title feat: getGeoDiff [DRAFT] feat: getGeoDiff Feb 15, 2026
@DoneDeal0 DoneDeal0 self-assigned this Feb 15, 2026
@DoneDeal0 DoneDeal0 force-pushed the getgeodiff branch 2 times, most recently from 738357f to 6ce692d Compare February 16, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant