Huge News!Announcing our $40M Series B led by Abstract Ventures.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 5.1.5 to 6.0.0

index.ts

32

index.js

@@ -1,5 +0,6 @@

import concaveman from 'concaveman';
import { coordEach } from '@turf/meta';
import { polygon, isObject } from '@turf/helpers';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var concaveman_1 = require("concaveman");
var meta_1 = require("@turf/meta");
var helpers_1 = require("@turf/helpers");
/**

@@ -33,23 +34,20 @@ * Takes a {@link Feature} or a {@link FeatureCollection} and returns a convex hull {@link Polygon}.

function convex(geojson, options) {
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var concavity = options.concavity || Infinity;
if (options === void 0) { options = {}; }
// Default parameters
options.concavity = options.concavity || Infinity;
// Container
var points = [];
// Convert all points to flat 2D coordinate Array
coordEach(geojson, function (coord) {
meta_1.coordEach(geojson, function (coord) {
points.push([coord[0], coord[1]]);
});
if (!points.length) return null;
var convexHull = concaveman(points, concavity);
if (!points.length)
return null;
var convexHull = concaveman_1.default(points, options.concavity);
// Convex hull should have at least 3 different vertices in order to create a valid polygon
if (convexHull.length > 3) {
return polygon([convexHull]);
return helpers_1.polygon([convexHull]);
}
return null;
}
export default convex;
exports.default = convex;
{
"name": "@turf/convex",
"version": "5.1.5",
"version": "6.0.0",
"description": "turf convex 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"

@@ -36,7 +32,6 @@ },

"devDependencies": {
"@std/esm": "*",
"benchmark": "*",
"glob": "*",
"load-json-file": "*",
"rollup": "*",
"typescript": "*",
"tape": "*",

@@ -46,10 +41,6 @@ "write-json-file": "*"

"dependencies": {
"@turf/helpers": "^5.1.5",
"@turf/meta": "^5.1.5",
"@turf/helpers": "6.x",
"@turf/meta": "6.x",
"concaveman": "*"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
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