@turf/bearing
Advanced tools
Comparing version 4.7.3 to 5.0.0
/// <reference types="geojson" /> | ||
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[]; | ||
export type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[]; | ||
interface Options { | ||
final?: boolean | ||
} | ||
/** | ||
* http://turfjs.org/docs/#bearing | ||
*/ | ||
declare function bearing(start: Point, end: Point, final?: boolean): number; | ||
declare namespace bearing { } | ||
export = bearing; | ||
export default function bearing(start: Point, end: Point, options?: Options): number; |
11
index.js
@@ -1,2 +0,2 @@ | ||
var getCoord = require('@turf/invariant').getCoord; | ||
import { getCoord } from '@turf/invariant'; | ||
//http://en.wikipedia.org/wiki/Haversine_formula | ||
@@ -12,3 +12,4 @@ //http://www.movable-type.co.uk/scripts/latlong.html | ||
* @param {Geometry|Feature<Point>|Array<number>} end ending Point | ||
* @param {boolean} [final=false] calculates the final bearing if true | ||
* @param {Object} [options] Optional parameters | ||
* @param {boolean} [options.final=false] calculates the final bearing if true | ||
* @returns {number} bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) | ||
@@ -27,3 +28,5 @@ * @example | ||
*/ | ||
function bearing(start, end, final) { | ||
function bearing(start, end, options) { | ||
// Backwards compatible with v4.0 | ||
var final = (typeof options === 'object') ? options.final : options; | ||
if (final === true) return calculateFinalBearing(start, end); | ||
@@ -63,2 +66,2 @@ | ||
module.exports = bearing; | ||
export default bearing; |
{ | ||
"name": "@turf/bearing", | ||
"version": "4.7.3", | ||
"version": "5.0.0", | ||
"description": "turf bearing 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", | ||
"posttest": "uglifyjs main.js -o main.min.js", | ||
"bench": "node -r @std/esm bench.js" | ||
}, | ||
@@ -30,11 +35,18 @@ "repository": { | ||
"devDependencies": { | ||
"@turf/destination": "^4.7.3", | ||
"@turf/helpers": "^4.7.3", | ||
"benchmark": "^2.1.4", | ||
"tape": "^4.6.3", | ||
"write-json-file": "^2.0.0" | ||
"@turf/destination": "*", | ||
"@turf/helpers": "5.0.0", | ||
"benchmark": "*", | ||
"tape": "*", | ||
"write-json-file": "*", | ||
"rollup": "*", | ||
"@std/esm": "*", | ||
"uglify-js": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/invariant": "^4.7.3" | ||
"@turf/invariant": "5.0.0" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
# @turf/bearing | ||
# bearing | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## bearing | ||
Takes two [points](http://geojson.org/geojson-spec.html#point) and finds the geographic bearing between them, | ||
@@ -12,3 +14,4 @@ i.e. the angle measured in degrees from the north line (0 degrees) | ||
- `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 | ||
- `final` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** calculates the final bearing if true (optional, default `false`) | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters | ||
- `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`) | ||
@@ -15,0 +18,0 @@ **Examples** |
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
9537
6
125
58
8
+ Added@turf/invariant@5.0.0(transitive)
- Removed@turf/invariant@4.7.3(transitive)
Updated@turf/invariant@5.0.0