Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/circle

Package Overview
Dependencies
Maintainers
4
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/circle - npm Package Compare versions

Comparing version 4.7.3 to 5.0.0

main.js

17

index.d.ts

@@ -1,11 +0,14 @@

/// <reference types="geojson" />
import { Feature, Point, Polygon, Units, Position } from '@turf/helpers'
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point | number[];
type Polygon = GeoJSON.Feature<GeoJSON.Polygon>;
/**
* http://turfjs.org/docs/#circle
*/
declare function circle(center: Point, radius: number, steps?: number, units?: string, properties?: any): Polygon;
declare namespace circle { }
export = circle;
export default function (
center: Feature<Point> | Point | Position,
radius: number,
options?: {
steps?: number;
units?: Units;
properties?: object;
}
): Feature<Polygon>;

@@ -1,3 +0,3 @@

var destination = require('@turf/destination');
var polygon = require('@turf/helpers').polygon;
import destination from '@turf/destination';
import { polygon } from '@turf/helpers';

@@ -10,5 +10,6 @@ /**

* @param {number} radius radius of the circle
* @param {number} [steps=64] number of steps
* @param {string} [units=kilometers] miles, kilometers, degrees, or radians
* @param {Object} [properties={}] properties
* @param {Object} [options={}] Optional parameters
* @param {number} [options.steps=64] number of steps
* @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
* @param {Object} [options.properties={}] properties
* @returns {Feature<Polygon>} circle polygon

@@ -27,6 +28,14 @@ * @example

*/
module.exports = function (center, radius, steps, units, properties) {
function circle(center, radius, options) {
// Optional params
options = options || {};
var steps = options.steps || 64;
var units = options.units;
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');

@@ -44,2 +53,4 @@ // default params

return polygon([coordinates], properties);
};
}
export default circle;
{
"name": "@turf/circle",
"version": "4.7.3",
"version": "5.0.0",
"description": "turf circle 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": {
"@turf/truncate": "^4.7.3",
"benchmark": "^2.1.4",
"load-json-file": "^2.0.0",
"tape": "^4.6.3",
"write-json-file": "^2.0.0"
"@turf/truncate": "*",
"benchmark": "*",
"load-json-file": "*",
"tape": "*",
"write-json-file": "*",
"rollup": "*",
"@std/esm": "*",
"uglify-js": "*"
},
"dependencies": {
"@turf/destination": "^4.7.3",
"@turf/helpers": "^4.7.3"
"@turf/destination": "5.0.0",
"@turf/helpers": "5.0.0"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/circle
# circle
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## circle
Takes a [Point](http://geojson.org/geojson-spec.html#point) and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.

@@ -11,5 +13,6 @@

- `radius` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** radius of the circle
- `steps` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** number of steps (optional, default `64`)
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** miles, kilometers, degrees, or radians (optional, default `kilometers`)
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional parameters
- `steps` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of steps (optional, default `64`)
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** miles, kilometers, degrees, or radians (optional, default `"kilometers"`)
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** properties (optional, default `{}`)

@@ -16,0 +19,0 @@ **Examples**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc