@turf/circle
Advanced tools
Comparing version 5.1.5 to 6.0.0
33
index.js
@@ -1,4 +0,5 @@ | ||
import destination from '@turf/destination'; | ||
import { polygon } from '@turf/helpers'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var destination_1 = require("@turf/destination"); | ||
var helpers_1 = require("@turf/helpers"); | ||
/** | ||
@@ -25,26 +26,14 @@ * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision. | ||
function circle(center, radius, options) { | ||
// Optional params | ||
options = options || {}; | ||
if (options === void 0) { options = {}; } | ||
// default params | ||
var steps = options.steps || 64; | ||
var properties = options.properties; | ||
// validation | ||
if (!center) throw new Error('center is required'); | ||
if (!radius) throw new Error('radius is required'); | ||
if (typeof options !== 'object') throw new Error('options must be an object'); | ||
if (typeof steps !== 'number') throw new Error('steps must be a number'); | ||
// default params | ||
steps = steps || 64; | ||
properties = properties || center.properties || {}; | ||
var properties = options.properties ? options.properties : (!Array.isArray(center) && center.type === 'Feature' && center.properties) ? center.properties : {}; | ||
// main | ||
var coordinates = []; | ||
for (var i = 0; i < steps; i++) { | ||
coordinates.push(destination(center, radius, i * -360 / steps, options).geometry.coordinates); | ||
coordinates.push(destination_1.default(center, radius, i * -360 / steps, options).geometry.coordinates); | ||
} | ||
coordinates.push(coordinates[0]); | ||
return polygon([coordinates], properties); | ||
return helpers_1.polygon([coordinates], properties); | ||
} | ||
export default circle; | ||
exports.default = circle; |
{ | ||
"name": "@turf/circle", | ||
"version": "5.1.5", | ||
"version": "6.0.0", | ||
"description": "turf circle module", | ||
"main": "main.js", | ||
"module": "main.es.js", | ||
"types": "index.d.ts", | ||
"main": "index", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"main.js", | ||
"main.es.js" | ||
"index.ts" | ||
], | ||
"scripts": { | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "node -r @std/esm ../../scripts/validate-es5-dependencies.js", | ||
"bench": "node -r @std/esm bench.js", | ||
"prepare": "tsc", | ||
"pretest": "tsc", | ||
"test": "node test.js", | ||
"bench": "node bench.js", | ||
"docs": "node ../../scripts/generate-readmes" | ||
@@ -41,7 +37,6 @@ }, | ||
"@mapbox/geojsonhint": "*", | ||
"@std/esm": "*", | ||
"@turf/truncate": "^5.1.5", | ||
"@turf/truncate": "*", | ||
"benchmark": "*", | ||
"load-json-file": "*", | ||
"rollup": "*", | ||
"typescript": "*", | ||
"tape": "*", | ||
@@ -51,9 +46,5 @@ "write-json-file": "*" | ||
"dependencies": { | ||
"@turf/destination": "^5.1.5", | ||
"@turf/helpers": "^5.1.5" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
"@turf/destination": "6.x", | ||
"@turf/helpers": "6.x" | ||
} | ||
} |
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
7
7924
5
77
+ Added@turf/destination@6.5.0(transitive)
+ Added@turf/helpers@6.5.0(transitive)
+ Added@turf/invariant@6.5.0(transitive)
- Removed@turf/destination@5.1.5(transitive)
- Removed@turf/helpers@5.1.5(transitive)
- Removed@turf/invariant@5.2.0(transitive)
Updated@turf/destination@6.x
Updated@turf/helpers@6.x