New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/convex

Package Overview
Dependencies
Maintainers
4
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.0.0 to 6.0.1

index.d.ts

15

index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
}
Object.defineProperty(exports, "__esModule", { value: true });
var concaveman_1 = require("concaveman");
var helpers_1 = require("@turf/helpers");
var meta_1 = require("@turf/meta");
var helpers_1 = require("@turf/helpers");
var concaveman_1 = __importDefault(require("concaveman"));
/**

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

* Internally this uses
* the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that
* implements a [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
* the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a
* [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
*

@@ -18,2 +21,3 @@ * @name convex

* @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.
* @param {Object} [options.properties={}] Translate Properties to Feature
* @returns {Feature<Polygon>} a convex hull

@@ -45,4 +49,5 @@ * @example

});
if (!points.length)
if (!points.length) {
return null;
}
var convexHull = concaveman_1.default(points, options.concavity);

@@ -49,0 +54,0 @@ // Convex hull should have at least 3 different vertices in order to create a valid polygon

@@ -1,4 +0,4 @@

import concaveman from 'concaveman';
import { coordEach } from '@turf/meta';
import { polygon, Feature, Polygon, AllGeoJSON, Properties } from '@turf/helpers';
import { AllGeoJSON, Feature, polygon, Polygon, Properties } from "@turf/helpers";
import { coordEach } from "@turf/meta";
import concaveman from "concaveman";

@@ -9,4 +9,4 @@ /**

* Internally this uses
* the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that
* implements a [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
* the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a
* [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
*

@@ -17,2 +17,3 @@ * @name convex

* @param {number} [options.concavity=Infinity] 1 - thin shape. Infinity - convex hull.
* @param {Object} [options.properties={}] Translate Properties to Feature
* @returns {Feature<Polygon>} a convex hull

@@ -37,3 +38,3 @@ * @example

properties?: P,
} = {}): Feature<Polygon, P> {
} = {}): Feature<Polygon, P> | null {
// Default parameters

@@ -43,11 +44,11 @@ options.concavity = options.concavity || Infinity;

// Container
var points = [];
const points: number[][] = [];
// Convert all points to flat 2D coordinate Array
coordEach(geojson, function (coord) {
coordEach(geojson, (coord) => {
points.push([coord[0], coord[1]]);
});
if (!points.length) return null;
if (!points.length) { return null; }
var convexHull = concaveman(points, options.concavity);
const convexHull = concaveman(points, options.concavity);

@@ -54,0 +55,0 @@ // Convex hull should have at least 3 different vertices in order to create a valid polygon

{
"name": "@turf/convex",
"version": "6.0.0",
"version": "6.0.1",
"description": "turf convex module",
"main": "index",
"types": "index.d.ts",
"files": [
"index.js",
"index.ts"
"index.ts",
"index.d.ts"
],

@@ -32,7 +34,10 @@ "scripts": {

"devDependencies": {
"@types/concaveman": "*",
"@types/tape": "*",
"benchmark": "*",
"glob": "*",
"load-json-file": "*",
"tape": "*",
"tslint": "*",
"typescript": "*",
"tape": "*",
"write-json-file": "*"

@@ -39,0 +44,0 @@ },

@@ -7,13 +7,14 @@ # @turf/convex

Takes a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) or a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns a convex hull [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6).
Takes a [Feature][1] or a [FeatureCollection][2] and returns a convex hull [Polygon][3].
Internally this uses
the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that
implements a [monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain).
the [convex-hull][4] module that
implements a [monotone chain hull][5].
**Parameters**
- `geojson` **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** input Feature or FeatureCollection
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)
- `options.concavity` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** 1 - thin shape. Infinity - convex hull. (optional, default `Infinity`)
- `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 `{}`)

@@ -38,4 +39,24 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)>** a convex hull
Returns **[Feature][9]&lt;[Polygon][10]>** a convex hull
[1]: https://tools.ietf.org/html/rfc7946#section-3.2
[2]: https://tools.ietf.org/html/rfc7946#section-3.3
[3]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[4]: https://github.com/mikolalysenko/convex-hull
[5]: http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
[6]: https://tools.ietf.org/html/rfc7946#section-3
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[9]: https://tools.ietf.org/html/rfc7946#section-3.2
[10]: https://tools.ietf.org/html/rfc7946#section-3.1.6
<!-- This file is automatically generated. Please don't edit it directly:

@@ -42,0 +63,0 @@ if you find an error, edit the source file (likely index.js), and re-run

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