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

@turf/line-to-polygon

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/line-to-polygon - npm Package Compare versions

Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3

dist/es/package.json

30

dist/es/index.js

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

import turfBBox from '@turf/bbox';
import { getCoords, getGeom } from '@turf/invariant';
import { polygon, multiPolygon, lineString } from '@turf/helpers';
import clone from '@turf/clone';
import turfBBox from "@turf/bbox";
import { getCoords, getGeom } from "@turf/invariant";
import { polygon, multiPolygon, lineString, } from "@turf/helpers";
import clone from "@turf/clone";
/**

@@ -32,5 +32,5 @@ * Converts (Multi)LineString(s) to Polygon(s).

// default params
autoComplete = (autoComplete !== undefined) ? autoComplete : true;
orderCoords = (orderCoords !== undefined) ? orderCoords : true;
mutate = (mutate !== undefined) ? mutate : false;
autoComplete = autoComplete !== undefined ? autoComplete : true;
orderCoords = orderCoords !== undefined ? orderCoords : true;
mutate = mutate !== undefined ? mutate : false;
if (!mutate) {

@@ -40,3 +40,3 @@ lines = clone(lines);

switch (lines.type) {
case 'FeatureCollection':
case "FeatureCollection":
var coords = [];

@@ -62,3 +62,7 @@ lines.features.forEach(function (line) {

function lineStringToPolygon(line, properties, autoComplete, orderCoords) {
properties = properties ? properties : (line.type === 'Feature') ? line.properties : {};
properties = properties
? properties
: line.type === "Feature"
? line.properties
: {};
var geom = getGeom(line);

@@ -68,9 +72,9 @@ var coords = geom.coordinates;

if (!coords.length)
throw new Error('line must contain coordinates');
throw new Error("line must contain coordinates");
switch (type) {
case 'LineString':
case "LineString":
if (autoComplete)
coords = autoCompleteCoords(coords);
return polygon([coords], properties);
case 'MultiLineString':
case "MultiLineString":
var multiCoords = [];

@@ -97,3 +101,3 @@ var largestArea = 0;

default:
throw new Error('geometry type ' + type + ' is not supported');
throw new Error("geometry type " + type + " is not supported");
}

@@ -100,0 +104,0 @@ }

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

import { Feature, FeatureCollection, MultiLineString, LineString, Polygon, MultiPolygon, Properties } from '@turf/helpers';
import { Feature, FeatureCollection, MultiLineString, LineString, Properties } from "@turf/helpers";
/**

@@ -26,7 +26,7 @@ * Converts (Multi)LineString(s) to Polygon(s).

mutate?: boolean;
}): Feature<MultiPolygon, {
}): Feature<import("@turf/helpers").MultiPolygon, {
[name: string]: any;
}> | Feature<Polygon, {
}> | Feature<import("@turf/helpers").Polygon, {
[name: string]: any;
}>;
export default lineToPolygon;

@@ -37,5 +37,5 @@ "use strict";

// default params
autoComplete = (autoComplete !== undefined) ? autoComplete : true;
orderCoords = (orderCoords !== undefined) ? orderCoords : true;
mutate = (mutate !== undefined) ? mutate : false;
autoComplete = autoComplete !== undefined ? autoComplete : true;
orderCoords = orderCoords !== undefined ? orderCoords : true;
mutate = mutate !== undefined ? mutate : false;
if (!mutate) {

@@ -45,3 +45,3 @@ lines = clone_1.default(lines);

switch (lines.type) {
case 'FeatureCollection':
case "FeatureCollection":
var coords = [];

@@ -67,3 +67,7 @@ lines.features.forEach(function (line) {

function lineStringToPolygon(line, properties, autoComplete, orderCoords) {
properties = properties ? properties : (line.type === 'Feature') ? line.properties : {};
properties = properties
? properties
: line.type === "Feature"
? line.properties
: {};
var geom = invariant_1.getGeom(line);

@@ -73,9 +77,9 @@ var coords = geom.coordinates;

if (!coords.length)
throw new Error('line must contain coordinates');
throw new Error("line must contain coordinates");
switch (type) {
case 'LineString':
case "LineString":
if (autoComplete)
coords = autoCompleteCoords(coords);
return helpers_1.polygon([coords], properties);
case 'MultiLineString':
case "MultiLineString":
var multiCoords = [];

@@ -102,3 +106,3 @@ var largestArea = 0;

default:
throw new Error('geometry type ' + type + ' is not supported');
throw new Error("geometry type " + type + " is not supported");
}

@@ -105,0 +109,0 @@ }

{
"name": "@turf/line-to-polygon",
"version": "6.2.0-alpha.2",
"version": "6.2.0-alpha.3",
"description": "turf line-to-polygon module",

@@ -30,2 +30,6 @@ "author": "Turf Authors",

"module": "dist/es/index.js",
"exports": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
},
"types": "dist/js/index.d.ts",

@@ -37,11 +41,10 @@ "sideEffects": false,

"scripts": {
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"prepare": "npm-run-all prepare:*",
"prepare:es": "tsc --outDir dist/es --module esnext --declaration false",
"prepare:js": "tsc",
"test": "npm-run-all prepare test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js",
"test:types": "tsc --esModuleInterop --noEmit types.ts"
},

@@ -54,2 +57,3 @@ "devDependencies": {

"tape": "*",
"ts-node": "*",
"tslint": "*",

@@ -60,8 +64,8 @@ "typescript": "*",

"dependencies": {
"@turf/bbox": "^6.2.0-alpha.2",
"@turf/clone": "^6.2.0-alpha.2",
"@turf/helpers": "^6.2.0-alpha.2",
"@turf/invariant": "^6.2.0-alpha.2"
"@turf/bbox": "^6.2.0-alpha.3",
"@turf/clone": "^6.2.0-alpha.3",
"@turf/helpers": "^6.2.0-alpha.3",
"@turf/invariant": "^6.2.0-alpha.3"
},
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09"
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409"
}
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