You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@turf/angle

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/angle - npm Package Compare versions

Comparing version

to
6.0.1

index.d.ts

30

index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
}
Object.defineProperty(exports, "__esModule", { value: true });
var bearing_1 = require("@turf/bearing");
var rhumb_bearing_1 = require("@turf/rhumb-bearing");
var bearing_1 = __importDefault(require("@turf/bearing"));
var helpers_1 = require("@turf/helpers");
var rhumb_bearing_1 = __importDefault(require("@turf/rhumb-bearing"));
/**

@@ -25,11 +28,15 @@ * Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise)

// Optional Parameters
if (!helpers_1.isObject(options))
throw new Error('options is invalid');
if (!helpers_1.isObject(options)) {
throw new Error("options is invalid");
}
// Validation
if (!startPoint)
throw new Error('startPoint is required');
if (!midPoint)
throw new Error('midPoint is required');
if (!endPoint)
throw new Error('endPoint is required');
if (!startPoint) {
throw new Error("startPoint is required");
}
if (!midPoint) {
throw new Error("midPoint is required");
}
if (!endPoint) {
throw new Error("endPoint is required");
}
// Rename to shorter variables

@@ -44,6 +51,7 @@ var A = startPoint;

// Explementary angle
if (options.explementary === true)
if (options.explementary === true) {
return 360 - angleAO;
}
return angleAO;
}
exports.default = angle;
{
"name": "@turf/angle",
"version": "6.0.0",
"version": "6.0.1",
"description": "turf angle module",
"main": "index",
"types": "index.d.ts",
"files": [
"index.js",
"index.ts"
"index.d.ts"
],

@@ -43,3 +44,5 @@ "scripts": {

"tape": "*",
"write-json-file": "*"
"write-json-file": "*",
"tslint": "*",
"@types/tape": "*"
},

@@ -46,0 +49,0 @@ "dependencies": {

@@ -12,8 +12,8 @@ # @turf/angle

- `startPoint` **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** Start Point Coordinates
- `midPoint` **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** Mid Point Coordinates
- `endPoint` **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** End Point Coordinates
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)
- `options.explementary` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns the explementary angle instead (360 - angle) (optional, default `false`)
- `options.mercator` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** if calculations should be performed over Mercator or WGS84 projection (optional, default `false`)
- `startPoint` **[Coord][1]** Start Point Coordinates
- `midPoint` **[Coord][1]** Mid Point Coordinates
- `endPoint` **[Coord][1]** End Point Coordinates
- `options` **[Object][2]** Optional parameters (optional, default `{}`)
- `options.explementary` **[boolean][3]** Returns the explementary angle instead (360 - angle) (optional, default `false`)
- `options.mercator` **[boolean][3]** if calculations should be performed over Mercator or WGS84 projection (optional, default `false`)

@@ -27,4 +27,12 @@ **Examples**

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Angle between the provided points, or its explementary.
Returns **[number][4]** Angle between the provided points, or its explementary.
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.1
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
<!-- This file is automatically generated. Please don't edit it directly:

@@ -31,0 +39,0 @@ if you find an error, edit the source file (likely index.js), and re-run