@turf/destination
Advanced tools
Comparing version 4.7.3 to 5.0.0
@@ -5,3 +5,3 @@ /// <reference types="geojson" /> | ||
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[]; | ||
export type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[]; | ||
@@ -11,4 +11,2 @@ /** | ||
*/ | ||
declare function destination(origin: Point, distance: number, bearing: number, units?: Units): GeoJSON.Feature<GeoJSON.Point>; | ||
declare namespace destination { } | ||
export = destination; | ||
export default function destination(origin: Point, distance: number, bearing: number, units?: Units): GeoJSON.Feature<GeoJSON.Point>; |
18
index.js
//http://en.wikipedia.org/wiki/Haversine_formula | ||
//http://www.movable-type.co.uk/scripts/latlong.html | ||
var getCoord = require('@turf/invariant').getCoord; | ||
var helpers = require('@turf/helpers'); | ||
var point = helpers.point; | ||
var distanceToRadians = helpers.distanceToRadians; | ||
import { getCoord } from '@turf/invariant'; | ||
import { point, distanceToRadians } from '@turf/helpers'; | ||
@@ -15,3 +13,4 @@ /** | ||
* @param {number} bearing ranging from -180 to 180 | ||
* @param {string} [units=kilometers] miles, kilometers, degrees, or radians | ||
* @param {Object} options Optional parameters | ||
* @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians | ||
* @returns {Feature<Point>} destination point | ||
@@ -31,3 +30,6 @@ * @example | ||
*/ | ||
module.exports = function (origin, distance, bearing, units) { | ||
function destination(origin, distance, bearing, options) { | ||
// Backwards compatible with v4.0 | ||
var units = (typeof options === 'object') ? options.units : options; | ||
var degrees2radians = Math.PI / 180; | ||
@@ -48,2 +50,4 @@ var radians2degrees = 180 / Math.PI; | ||
return point([radians2degrees * longitude2, radians2degrees * latitude2]); | ||
}; | ||
} | ||
export default destination; |
{ | ||
"name": "@turf/destination", | ||
"version": "4.7.3", | ||
"version": "5.0.0", | ||
"description": "turf destination 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" | ||
}, | ||
@@ -34,12 +39,19 @@ "repository": { | ||
"devDependencies": { | ||
"benchmark": "^2.1.4", | ||
"glob": "7.1.2", | ||
"load-json-file": "^2.0.0", | ||
"tape": "4.8.0", | ||
"write-json-file": "^2.0.0" | ||
"benchmark": "*", | ||
"glob": "*", | ||
"load-json-file": "*", | ||
"tape": "*", | ||
"write-json-file": "*", | ||
"rollup": "*", | ||
"@std/esm": "*", | ||
"uglify-js": "*" | ||
}, | ||
"dependencies": { | ||
"@turf/helpers": "^4.7.3", | ||
"@turf/invariant": "^4.7.3" | ||
"@turf/helpers": "5.0.0", | ||
"@turf/invariant": "5.0.0" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
# @turf/destination | ||
# destination | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
## destination | ||
Takes a [Point](http://geojson.org/geojson-spec.html#point) and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature. | ||
@@ -12,3 +14,3 @@ | ||
- `bearing` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** ranging from -180 to 180 | ||
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** miles, kilometers, degrees, or radians (optional, default `kilometers`) | ||
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** miles, kilometers, degrees, or radians (optional, default `kilometers`) | ||
@@ -15,0 +17,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
9308
6
94
58
8
+ Added@turf/helpers@5.0.0(transitive)
+ Added@turf/invariant@5.0.0(transitive)
- Removed@turf/helpers@4.7.3(transitive)
- Removed@turf/invariant@4.7.3(transitive)
Updated@turf/helpers@5.0.0
Updated@turf/invariant@5.0.0