Skip to content

Commit

Permalink
Simplify unnecessary union type in turfDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
isti115 committed Jun 13, 2024
1 parent 0707f84 commit 15f436d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/turf-distance/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { Point } from "geojson";
import { getCoord } from "@turf/invariant";
import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";

//http://en.wikipedia.org/wiki/Haversine_formula
//http://www.movable-type.co.uk/scripts/latlong.html

/**
* Calculates the distance between two {@link Point|points} in degrees, radians, miles, or kilometers.
* Calculates the distance between two {@link Coord|coordinates} in degrees, radians, miles, or kilometers.
* This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
*
* @name distance
* @param {Coord | Point} from origin point or coordinate
* @param {Coord | Point} to destination point or coordinate
* @param {Coord} from origin coordinate
* @param {Coord} to destination coordinate
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers
* @returns {number} distance between the two points
* @returns {number} distance between the two coordinates
* @example
* var from = turf.point([-75.343, 39.984]);
* var to = turf.point([-75.534, 39.123]);
Expand All @@ -28,8 +27,8 @@ import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";
* to.properties.distance = distance;
*/
function distance(
from: Coord | Point,
to: Coord | Point,
from: Coord,
to: Coord,
options: {
units?: Units;
} = {}
Expand Down

0 comments on commit 15f436d

Please sign in to comment.