@turf/bearing
Advanced tools
Comparing version 5.0.4 to 5.1.0
11
index.js
@@ -12,5 +12,5 @@ import { getCoord } from '@turf/invariant'; | ||
* @name bearing | ||
* @param {Geometry|Feature<Point>|Array<number>} start starting Point | ||
* @param {Geometry|Feature<Point>|Array<number>} end ending Point | ||
* @param {Object} [options] Optional parameters | ||
* @param {Coord} start starting Point | ||
* @param {Coord} end ending Point | ||
* @param {Object} [options={}] Optional parameters | ||
* @param {boolean} [options.final=false] calculates the final bearing if true | ||
@@ -55,5 +55,6 @@ * @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) | ||
* Calculates Final Bearing | ||
* | ||
* @private | ||
* @param {Feature<Point>} start starting Point | ||
* @param {Feature<Point>} end ending Point | ||
* @param {Coord} start starting Point | ||
* @param {Coord} end ending Point | ||
* @returns {number} bearing | ||
@@ -60,0 +61,0 @@ */ |
15
main.js
@@ -14,5 +14,5 @@ 'use strict'; | ||
* @name bearing | ||
* @param {Geometry|Feature<Point>|Array<number>} start starting Point | ||
* @param {Geometry|Feature<Point>|Array<number>} end ending Point | ||
* @param {Object} [options] Optional parameters | ||
* @param {Coord} start starting Point | ||
* @param {Coord} end ending Point | ||
* @param {Object} [options={}] Optional parameters | ||
* @param {boolean} [options.final=false] calculates the final bearing if true | ||
@@ -35,7 +35,7 @@ * @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) | ||
options = options || {}; | ||
if (!helpers.isObject(options)) throw new Error('options is invalid'); | ||
if (!helpers.isObject(options)) { throw new Error('options is invalid'); } | ||
var final = options.final; | ||
// Reverse calculation | ||
if (final === true) return calculateFinalBearing(start, end); | ||
if (final === true) { return calculateFinalBearing(start, end); } | ||
@@ -58,5 +58,6 @@ var coordinates1 = invariant.getCoord(start); | ||
* Calculates Final Bearing | ||
* | ||
* @private | ||
* @param {Feature<Point>} start starting Point | ||
* @param {Feature<Point>} end ending Point | ||
* @param {Coord} start starting Point | ||
* @param {Coord} end ending Point | ||
* @returns {number} bearing | ||
@@ -63,0 +64,0 @@ */ |
{ | ||
"name": "@turf/bearing", | ||
"version": "5.0.4", | ||
"version": "5.1.0", | ||
"description": "turf bearing module", | ||
"main": "main", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"main": "main.js", | ||
"module": "main.mjs", | ||
"types": "index.d.ts", | ||
@@ -12,3 +11,4 @@ "files": [ | ||
"index.d.ts", | ||
"main.js" | ||
"main.js", | ||
"main.mjs" | ||
], | ||
@@ -18,3 +18,4 @@ "scripts": { | ||
"test": "node -r @std/esm test.js", | ||
"bench": "node -r @std/esm bench.js" | ||
"bench": "node -r @std/esm bench.js", | ||
"docs": "node ../../scripts/generate-readmes" | ||
}, | ||
@@ -37,5 +38,6 @@ "repository": { | ||
"@std/esm": "*", | ||
"@turf/destination": "^5.0.4", | ||
"@turf/destination": "^5.1.0", | ||
"benchmark": "*", | ||
"rollup": "*", | ||
"rollup-plugin-buble": "*", | ||
"tape": "*", | ||
@@ -45,4 +47,4 @@ "write-json-file": "*" | ||
"dependencies": { | ||
"@turf/helpers": "^5.0.4", | ||
"@turf/invariant": "^5.0.4" | ||
"@turf/helpers": "^5.1.0", | ||
"@turf/invariant": "^5.1.0" | ||
}, | ||
@@ -49,0 +51,0 @@ "@std/esm": { |
@@ -7,3 +7,3 @@ # @turf/bearing | ||
Takes two [points](http://geojson.org/geojson-spec.html#point) and finds the geographic bearing between them, | ||
Takes two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and finds the geographic bearing between them, | ||
i.e. the angle measured in degrees from the north line (0 degrees) | ||
@@ -13,5 +13,5 @@ | ||
- `start` **([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)> | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>)** starting Point | ||
- `end` **([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)> | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>)** ending Point | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters | ||
- `start` **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** starting Point | ||
- `end` **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** ending Point | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`) | ||
- `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`) | ||
@@ -18,0 +18,0 @@ |
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
10973
7
190
7
Updated@turf/helpers@^5.1.0
Updated@turf/invariant@^5.1.0