@turf/midpoint
Advanced tools
Comparing version 4.7.3 to 5.0.4
@@ -1,11 +0,9 @@ | ||
/// <reference types="geojson" /> | ||
import { Feature, Point, Coord } from '@turf/helpers' | ||
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[]; | ||
type Feature = GeoJSON.Feature<GeoJSON.Point>; | ||
/** | ||
* http://turfjs.org/docs/#midpoint | ||
*/ | ||
declare function midpoint(point1: Point, point2: Point): Feature; | ||
declare namespace midpoint { } | ||
export = midpoint; | ||
export default function midpoint( | ||
point1: Coord, | ||
point2: Coord | ||
): Feature<Point>; |
16
index.js
@@ -1,4 +0,4 @@ | ||
var bearing = require('@turf/bearing'); | ||
var destination = require('@turf/destination'); | ||
var distance = require('@turf/distance'); | ||
import bearing from '@turf/bearing'; | ||
import destination from '@turf/destination'; | ||
import distance from '@turf/distance'; | ||
@@ -23,8 +23,10 @@ /** | ||
*/ | ||
module.exports = function (point1, point2) { | ||
var dist = distance(point1, point2, 'miles'); | ||
function midpoint(point1, point2) { | ||
var dist = distance(point1, point2); | ||
var heading = bearing(point1, point2); | ||
var midpoint = destination(point1, dist / 2, heading, 'miles'); | ||
var midpoint = destination(point1, dist / 2, heading); | ||
return midpoint; | ||
}; | ||
} | ||
export default midpoint; |
{ | ||
"name": "@turf/midpoint", | ||
"version": "4.7.3", | ||
"version": "5.0.4", | ||
"description": "turf midpoint module", | ||
"main": "index.js", | ||
"main": "main", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
"index.d.ts", | ||
"main.js" | ||
], | ||
"scripts": { | ||
"test": "node test.js", | ||
"bench": "node bench.js" | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"bench": "node -r @std/esm bench.js" | ||
}, | ||
@@ -33,11 +37,17 @@ "repository": { | ||
"devDependencies": { | ||
"@turf/helpers": "^4.7.3", | ||
"benchmark": "^2.1.4", | ||
"tape": "^4.6.3" | ||
"@std/esm": "*", | ||
"@turf/helpers": "^5.0.4", | ||
"benchmark": "*", | ||
"rollup": "*", | ||
"tape": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/bearing": "^4.7.3", | ||
"@turf/destination": "^4.7.3", | ||
"@turf/distance": "^4.7.3" | ||
"@turf/bearing": "^5.0.4", | ||
"@turf/destination": "^5.0.4", | ||
"@turf/distance": "^5.0.4" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
# @turf/midpoint | ||
# midpoint | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## midpoint | ||
Takes two [points](http://geojson.org/geojson-spec.html#point) and returns a point midway between them. | ||
@@ -6,0 +8,0 @@ The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6913
6
66
54
5
+ Added@turf/bearing@5.1.5(transitive)
+ Added@turf/destination@5.1.5(transitive)
+ Added@turf/distance@5.1.5(transitive)
+ Added@turf/helpers@5.1.5(transitive)
+ Added@turf/invariant@5.2.0(transitive)
- Removed@turf/bearing@4.7.3(transitive)
- Removed@turf/destination@4.7.3(transitive)
- Removed@turf/distance@4.7.3(transitive)
- Removed@turf/helpers@4.7.3(transitive)
- Removed@turf/invariant@4.7.3(transitive)
Updated@turf/bearing@^5.0.4
Updated@turf/destination@^5.0.4
Updated@turf/distance@^5.0.4