Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/midpoint

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/midpoint - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

12

index.d.ts

@@ -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>;

@@ -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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc