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

@turf/rhumb-bearing

Package Overview
Dependencies
Maintainers
7
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/rhumb-bearing - npm Package Compare versions

Comparing version 6.5.0 to 7.0.0-alpha.0

17

dist/es/index.js

@@ -25,5 +25,4 @@ // https://en.wikipedia.org/wiki/Rhumb_line

*/
function rhumbBearing(start, end, options) {
if (options === void 0) { options = {}; }
var bear360;
function rhumbBearing(start, end, options = {}) {
let bear360;
if (options.final) {

@@ -35,3 +34,3 @@ bear360 = calculateRhumbBearing(getCoord(end), getCoord(start));

}
var bear180 = bear360 > 180 ? -(360 - bear360) : bear360;
const bear180 = bear360 > 180 ? -(360 - bear360) : bear360;
return bear180;

@@ -57,5 +56,5 @@ }

// θ => theta
var phi1 = degreesToRadians(from[1]);
var phi2 = degreesToRadians(to[1]);
var deltaLambda = degreesToRadians(to[0] - from[0]);
const phi1 = degreesToRadians(from[1]);
const phi2 = degreesToRadians(to[1]);
let deltaLambda = degreesToRadians(to[0] - from[0]);
// if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian:

@@ -68,6 +67,6 @@ if (deltaLambda > Math.PI) {

}
var deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));
var theta = Math.atan2(deltaLambda, deltaPsi);
const deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));
const theta = Math.atan2(deltaLambda, deltaPsi);
return (radiansToDegrees(theta) + 360) % 360;
}
export default rhumbBearing;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// https://en.wikipedia.org/wiki/Rhumb_line
var helpers_1 = require("@turf/helpers");
var invariant_1 = require("@turf/invariant");
const helpers_1 = require("@turf/helpers");
const invariant_1 = require("@turf/invariant");
/**

@@ -27,5 +27,4 @@ * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line

*/
function rhumbBearing(start, end, options) {
if (options === void 0) { options = {}; }
var bear360;
function rhumbBearing(start, end, options = {}) {
let bear360;
if (options.final) {

@@ -37,3 +36,3 @@ bear360 = calculateRhumbBearing(invariant_1.getCoord(end), invariant_1.getCoord(start));

}
var bear180 = bear360 > 180 ? -(360 - bear360) : bear360;
const bear180 = bear360 > 180 ? -(360 - bear360) : bear360;
return bear180;

@@ -59,5 +58,5 @@ }

// θ => theta
var phi1 = helpers_1.degreesToRadians(from[1]);
var phi2 = helpers_1.degreesToRadians(to[1]);
var deltaLambda = helpers_1.degreesToRadians(to[0] - from[0]);
const phi1 = helpers_1.degreesToRadians(from[1]);
const phi2 = helpers_1.degreesToRadians(to[1]);
let deltaLambda = helpers_1.degreesToRadians(to[0] - from[0]);
// if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian:

@@ -70,6 +69,6 @@ if (deltaLambda > Math.PI) {

}
var deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));
var theta = Math.atan2(deltaLambda, deltaPsi);
const deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));
const theta = Math.atan2(deltaLambda, deltaPsi);
return (helpers_1.radiansToDegrees(theta) + 360) % 360;
}
exports.default = rhumbBearing;
{
"name": "@turf/rhumb-bearing",
"version": "6.5.0",
"version": "7.0.0-alpha.0",
"description": "turf rhumb-bearing module",

@@ -55,3 +55,3 @@ "author": "Turf Authors",

"devDependencies": {
"@turf/destination": "^6.5.0",
"@turf/destination": "^7.0.0-alpha.0",
"@types/tape": "*",

@@ -67,6 +67,7 @@ "benchmark": "*",

"dependencies": {
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0"
"@turf/helpers": "^7.0.0-alpha.0",
"@turf/invariant": "^7.0.0-alpha.0",
"tslib": "^2.3.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
}

@@ -10,11 +10,12 @@ # @turf/rhumb-bearing

**Parameters**
### Parameters
- `start` **[Coord][2]** starting Point
- `end` **[Coord][2]** ending Point
- `options` **[Object][3]?** Optional parameters
- `options.final` **[boolean][4]** calculates the final bearing if true (optional, default `false`)
* `start` **[Coord][2]** starting Point
* `end` **[Coord][2]** ending Point
* `options` **[Object][3]?** Optional parameters
**Examples**
* `options.final` **[boolean][4]** calculates the final bearing if true (optional, default `false`)
### Examples
```javascript

@@ -21,0 +22,0 @@ var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"});

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