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

@turf/convex

Package Overview
Dependencies
Maintainers
7
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/convex - npm Package Compare versions

Comparing version 6.5.0 to 7.0.0-alpha.0

11

dist/es/index.js

@@ -1,2 +0,2 @@

import { polygon, } from "@turf/helpers";
import { polygon } from "@turf/helpers";
import { coordEach } from "@turf/meta";

@@ -32,10 +32,9 @@ import concaveman from "concaveman";

*/
export default function convex(geojson, options) {
if (options === void 0) { options = {}; }
export default function convex(geojson, options = {}) {
// Default parameters
options.concavity = options.concavity || Infinity;
// Container
var points = [];
const points = [];
// Convert all points to flat 2D coordinate Array
coordEach(geojson, function (coord) {
coordEach(geojson, (coord) => {
points.push([coord[0], coord[1]]);

@@ -46,3 +45,3 @@ });

}
var convexHull = concaveman(points, options.concavity);
const convexHull = concaveman(points, options.concavity);
// Convex hull should have at least 3 different vertices in order to create a valid polygon

@@ -49,0 +48,0 @@ if (convexHull.length > 3) {

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

import { AllGeoJSON, Feature, Polygon, Properties } from "@turf/helpers";
import { Feature, GeoJsonProperties, Polygon } from "geojson";
import { AllGeoJSON } from "@turf/helpers";
/**

@@ -30,5 +31,5 @@ * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.

*/
export default function convex<P = Properties>(geojson: AllGeoJSON, options?: {
export default function convex<P = GeoJsonProperties>(geojson: AllGeoJSON, options?: {
concavity?: number;
properties?: P;
}): Feature<Polygon, P> | null;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var helpers_1 = require("@turf/helpers");
var meta_1 = require("@turf/meta");
var concaveman_1 = __importDefault(require("concaveman"));
const tslib_1 = require("tslib");
const helpers_1 = require("@turf/helpers");
const meta_1 = require("@turf/meta");
const concaveman_1 = tslib_1.__importDefault(require("concaveman"));
/**

@@ -37,10 +35,9 @@ * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.

*/
function convex(geojson, options) {
if (options === void 0) { options = {}; }
function convex(geojson, options = {}) {
// Default parameters
options.concavity = options.concavity || Infinity;
// Container
var points = [];
const points = [];
// Convert all points to flat 2D coordinate Array
meta_1.coordEach(geojson, function (coord) {
meta_1.coordEach(geojson, (coord) => {
points.push([coord[0], coord[1]]);

@@ -51,3 +48,3 @@ });

}
var convexHull = concaveman_1.default(points, options.concavity);
const convexHull = concaveman_1.default(points, options.concavity);
// Convex hull should have at least 3 different vertices in order to create a valid polygon

@@ -54,0 +51,0 @@ if (convexHull.length > 3) {

{
"name": "@turf/convex",
"version": "6.5.0",
"version": "7.0.0-alpha.0",
"description": "turf convex module",

@@ -47,3 +47,3 @@ "author": "Turf Authors",

"devDependencies": {
"@types/concaveman": "*",
"@types/concaveman": "^1.1.3",
"@types/tape": "*",

@@ -61,7 +61,8 @@ "benchmark": "*",

"dependencies": {
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0",
"concaveman": "*"
"@turf/helpers": "^7.0.0-alpha.0",
"@turf/meta": "^7.0.0-alpha.0",
"concaveman": "^1.2.1",
"tslib": "^2.3.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
}

@@ -10,14 +10,15 @@ # @turf/convex

Internally this uses
the [convex-hull][4] module that
implements a [monotone chain hull][5].
the [convex-hull][4] module that implements a
[monotone chain hull][5].
**Parameters**
### Parameters
- `geojson` **[GeoJSON][6]** input Feature or FeatureCollection
- `options` **[Object][7]** Optional parameters (optional, default `{}`)
- `options.concavity` **[number][8]** 1 - thin shape. Infinity - convex hull. (optional, default `Infinity`)
- `options.properties` **[Object][7]** Translate Properties to Feature (optional, default `{}`)
* `geojson` **[GeoJSON][6]** input Feature or FeatureCollection
* `options` **[Object][7]** Optional parameters (optional, default `{}`)
**Examples**
* `options.concavity` **[number][8]** 1 - thin shape. Infinity - convex hull. (optional, default `Infinity`)
* `options.properties` **[Object][7]** Translate Properties to Feature (optional, default `{}`)
### Examples
```javascript

@@ -39,3 +40,3 @@ var points = turf.featureCollection([

Returns **[Feature][9]&lt;[Polygon][10]>** a convex hull
Returns **[Feature][9]<[Polygon][10]>** a convex hull

@@ -42,0 +43,0 @@ [1]: https://tools.ietf.org/html/rfc7946#section-3.2

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