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

@turf/rhumb-bearing

Package Overview
Dependencies
Maintainers
4
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 5.0.0 to 5.0.4

8

index.d.ts

@@ -1,9 +0,9 @@

import { Point, Feature, Position } from '@turf/helpers'
import { Coord } from '@turf/helpers'
/**
* http://turfjs.org/docs/#rhumb-bearing
* http://turfjs.org/docs/#rhumbbearing
*/
export default function rhumbBearing(
start: Feature<Point> | Point | Position,
end: Feature<Point> | Point | Position,
start: Coord,
end: Coord,
options?: {

@@ -10,0 +10,0 @@ final?: boolean;

// https://en.wikipedia.org/wiki/Rhumb_line
import {getCoord} from '@turf/invariant';
import {radians2degrees, degrees2radians} from '@turf/helpers';
import {radiansToDegrees, degreesToRadians, isObject} from '@turf/helpers';

@@ -10,4 +10,4 @@ /**

* @name rhumbBearing
* @param {(Geometry|Feature<Point>)|Position} start starting Point
* @param {(Geometry|Feature<Point>)|Position} end ending Point
* @param {Coord} start starting Point
* @param {Coord} end ending Point
* @param {Object} [options] Optional parameters

@@ -28,6 +28,10 @@ * @param {boolean} [options.final=false] calculates the final bearing if true

function rhumbBearing(start, end, options) {
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var final = options.final;
// validation
if (!start) throw new Error('start point is required');
if (!end) throw new Error('end point is required');
var final = (typeof options === 'object') ? options.final : options;

@@ -62,5 +66,5 @@ var bear360;

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

@@ -74,5 +78,5 @@ if (deltaLambda > Math.PI) deltaLambda -= 2 * Math.PI;

return (radians2degrees(theta) + 360) % 360;
return (radiansToDegrees(theta) + 360) % 360;
}
export default rhumbBearing;

@@ -12,4 +12,4 @@ 'use strict';

* @name rhumbBearing
* @param {(Geometry|Feature<Point>)|Position} start starting Point
* @param {(Geometry|Feature<Point>)|Position} end ending Point
* @param {Coord} start starting Point
* @param {Coord} end ending Point
* @param {Object} [options] Optional parameters

@@ -30,6 +30,10 @@ * @param {boolean} [options.final=false] calculates the final bearing if true

function rhumbBearing(start, end, options) {
// Optional parameters
options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
var final = options.final;
// validation
if (!start) throw new Error('start point is required');
if (!end) throw new Error('end point is required');
var final = (typeof options === 'object') ? options.final : options;

@@ -64,5 +68,5 @@ var bear360;

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

@@ -76,3 +80,3 @@ if (deltaLambda > Math.PI) deltaLambda -= 2 * Math.PI;

return (helpers.radians2degrees(theta) + 360) % 360;
return (helpers.radiansToDegrees(theta) + 360) % 360;
}

@@ -79,0 +83,0 @@

{
"name": "@turf/rhumb-bearing",
"version": "5.0.0",
"version": "5.0.4",
"description": "turf rhumb-bearing module",

@@ -17,3 +17,2 @@ "main": "main",

"test": "node -r @std/esm test.js",
"posttest": "uglifyjs main.js -o main.min.js",
"bench": "node -r @std/esm bench.js"

@@ -44,13 +43,12 @@ },

"devDependencies": {
"@turf/destination": "*",
"@std/esm": "*",
"@turf/destination": "^5.0.4",
"benchmark": "*",
"rollup": "*",
"tape": "*",
"write-json-file": "*",
"rollup": "*",
"@std/esm": "*",
"uglify-js": "*"
"write-json-file": "*"
},
"dependencies": {
"@turf/helpers": "5.0.0",
"@turf/invariant": "5.0.0"
"@turf/helpers": "^5.0.4",
"@turf/invariant": "^5.0.4"
},

@@ -57,0 +55,0 @@ "@std/esm": {

@@ -12,4 +12,4 @@ # @turf/rhumb-bearing

- `start` **(([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>) | Position)** starting Point
- `end` **(([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>) | Position)** ending Point
- `start` **Coord** starting Point
- `end` **Coord** ending Point
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters

@@ -16,0 +16,0 @@ - `options.final` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** calculates the final bearing if true (optional, default `false`)

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