@turf/circle
Advanced tools
Comparing version 6.5.0 to 7.0.0-alpha.0
import destination from "@turf/destination"; | ||
import { polygon, } from "@turf/helpers"; | ||
import { polygon } from "@turf/helpers"; | ||
/** | ||
@@ -23,7 +23,6 @@ * 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) { | ||
if (options === void 0) { options = {}; } | ||
function circle(center, radius, options = {}) { | ||
// default params | ||
var steps = options.steps || 64; | ||
var properties = options.properties | ||
const steps = options.steps || 64; | ||
const properties = options.properties | ||
? options.properties | ||
@@ -34,4 +33,4 @@ : !Array.isArray(center) && center.type === "Feature" && center.properties | ||
// main | ||
var coordinates = []; | ||
for (var i = 0; i < steps; i++) { | ||
const coordinates = []; | ||
for (let i = 0; i < steps; i++) { | ||
coordinates.push(destination(center, radius, (i * -360) / steps, options).geometry | ||
@@ -38,0 +37,0 @@ .coordinates); |
@@ -1,2 +0,3 @@ | ||
import { Units, Point, Properties, Feature, Polygon } from "@turf/helpers"; | ||
import { GeoJsonProperties, Feature, Point, Polygon } from "geojson"; | ||
import { Units } from "@turf/helpers"; | ||
/** | ||
@@ -22,3 +23,3 @@ * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision. | ||
*/ | ||
declare function circle<P = Properties>(center: number[] | Point | Feature<Point, P>, radius: number, options?: { | ||
declare function circle<P = GeoJsonProperties>(center: number[] | Point | Feature<Point, P>, radius: number, options?: { | ||
steps?: number; | ||
@@ -25,0 +26,0 @@ units?: Units; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var destination_1 = __importDefault(require("@turf/destination")); | ||
var helpers_1 = require("@turf/helpers"); | ||
const tslib_1 = require("tslib"); | ||
const destination_1 = tslib_1.__importDefault(require("@turf/destination")); | ||
const helpers_1 = require("@turf/helpers"); | ||
/** | ||
@@ -28,7 +26,6 @@ * 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) { | ||
if (options === void 0) { options = {}; } | ||
function circle(center, radius, options = {}) { | ||
// default params | ||
var steps = options.steps || 64; | ||
var properties = options.properties | ||
const steps = options.steps || 64; | ||
const properties = options.properties | ||
? options.properties | ||
@@ -39,4 +36,4 @@ : !Array.isArray(center) && center.type === "Feature" && center.properties | ||
// main | ||
var coordinates = []; | ||
for (var i = 0; i < steps; i++) { | ||
const coordinates = []; | ||
for (let i = 0; i < steps; i++) { | ||
coordinates.push(destination_1.default(center, radius, (i * -360) / steps, options).geometry | ||
@@ -43,0 +40,0 @@ .coordinates); |
{ | ||
"name": "@turf/circle", | ||
"version": "6.5.0", | ||
"version": "7.0.0-alpha.0", | ||
"description": "turf circle module", | ||
@@ -49,7 +49,7 @@ "author": "Turf Authors", | ||
"test:tape": "ts-node -r esm test.js", | ||
"test:types": "tsc --esModuleInterop --noEmit types.ts" | ||
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts" | ||
}, | ||
"devDependencies": { | ||
"@mapbox/geojsonhint": "*", | ||
"@turf/truncate": "^6.5.0", | ||
"@turf/truncate": "^7.0.0-alpha.0", | ||
"@types/tape": "*", | ||
@@ -66,6 +66,7 @@ "benchmark": "*", | ||
"dependencies": { | ||
"@turf/destination": "^6.5.0", | ||
"@turf/helpers": "^6.5.0" | ||
"@turf/destination": "^7.0.0-alpha.0", | ||
"@turf/helpers": "^7.0.0-alpha.0", | ||
"tslib": "^2.3.0" | ||
}, | ||
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e" | ||
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189" | ||
} |
@@ -9,13 +9,14 @@ # @turf/circle | ||
**Parameters** | ||
### Parameters | ||
- `center` **([Feature][2]<[Point][3]> | [Array][4]<[number][5]>)** center point | ||
- `radius` **[number][5]** radius of the circle | ||
- `options` **[Object][6]** Optional parameters (optional, default `{}`) | ||
- `options.steps` **[number][5]** number of steps (optional, default `64`) | ||
- `options.units` **[string][7]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`) | ||
- `options.properties` **[Object][6]** properties (optional, default `{}`) | ||
* `center` **([Feature][2]<[Point][3]> | [Array][4]<[number][5]>)** center point | ||
* `radius` **[number][5]** radius of the circle | ||
* `options` **[Object][6]** Optional parameters (optional, default `{}`) | ||
**Examples** | ||
* `options.steps` **[number][5]** number of steps (optional, default `64`) | ||
* `options.units` **[string][7]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`) | ||
* `options.properties` **[Object][6]** properties (optional, default `{}`) | ||
### Examples | ||
```javascript | ||
@@ -31,3 +32,3 @@ var center = [-75.343, 39.984]; | ||
Returns **[Feature][2]<[Polygon][8]>** circle polygon | ||
Returns **[Feature][2]<[Polygon][8]>** circle polygon | ||
@@ -34,0 +35,0 @@ [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2 |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
73
9569
3
111
1
+ Addedtslib@^2.3.0
+ Added@turf/destination@7.1.0(transitive)
+ Added@turf/helpers@7.1.0(transitive)
+ Added@turf/invariant@7.1.0(transitive)
+ Added@types/geojson@7946.0.14(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@turf/destination@6.5.0(transitive)
- Removed@turf/helpers@6.5.0(transitive)
- Removed@turf/invariant@6.5.0(transitive)
Updated@turf/helpers@^7.0.0-alpha.0