@turf/line-to-polygon 6.5.0 → 7.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,15 +6,17 @@
6
6
 
7
7
  Converts (Multi)LineString(s) to Polygon(s).
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `lines` **([FeatureCollection][1] \| [Feature][2]<([LineString][3] \| [MultiLineString][4])>)** Features to convert
12
- - `options` **[Object][5]** Optional parameters (optional, default `{}`)
13
- - `options.properties` **[Object][5]** translates GeoJSON properties to Feature (optional, default `{}`)
14
- - `options.autoComplete` **[boolean][6]** auto complete linestrings (matches first & last coordinates) (optional, default `true`)
15
- - `options.orderCoords` **[boolean][6]** sorts linestrings to place outer ring at the first position of the coordinates (optional, default `true`)
11
+ * `lines` **([FeatureCollection][1] | [Feature][2]<([LineString][3] | [MultiLineString][4])>)** Features to convert
12
+ * `options` **[Object][5]** Optional parameters (optional, default `{}`)
16
13
 
17
- **Examples**
14
+ * `options.properties` **[Object][5]** translates GeoJSON properties to Feature (optional, default `{}`)
15
+ * `options.autoComplete` **[boolean][6]** auto complete linestrings (matches first & last coordinates) (optional, default `true`)
16
+ * `options.orderCoords` **[boolean][6]** sorts linestrings to place outer ring at the first position of the coordinates (optional, default `true`)
17
+ * `options.mutate` **[boolean][6]** mutate the original linestring using autoComplete (matches first & last coordinates) (optional, default `false`)
18
+
19
+ ### Examples
18
20
 
19
21
  ```javascript
20
22
  var line = turf.lineString([[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]);
@@ -25,7 +27,7 @@ var polygon = turf.lineToPolygon(line);
25
27
  var addToMap = [polygon];
26
28
  ```
27
29
 
28
- Returns **[Feature][2]&lt;([Polygon][7] \| [MultiPolygon][8])>** converted to Polygons
30
+ Returns **[Feature][2]<([Polygon][7] | [MultiPolygon][8])>** converted to Polygons
29
31
 
30
32
  [1]: https://tools.ietf.org/html/rfc7946#section-3.3
31
33
 
package/dist/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import turfBBox from "@turf/bbox";
2
2
  import { getCoords, getGeom } from "@turf/invariant";
3
- import { polygon, multiPolygon, lineString, } from "@turf/helpers";
3
+ import { polygon, multiPolygon, lineString } from "@turf/helpers";
4
4
  import clone from "@turf/clone";
5
5
  /**
6
6
  * Converts (Multi)LineString(s) to Polygon(s).
@@ -21,8 +21,7 @@ import clone from "@turf/clone";
21
21
  * //addToMap
22
22
  * var addToMap = [polygon];
23
23
  */
24
- function lineToPolygon(lines, options) {
25
- if (options === void 0) { options = {}; }
24
+ function lineToPolygon(lines, options = {}) {
26
25
  var _a, _b, _c;
27
26
  // Optional parameters
28
27
  var properties = options.properties;
@@ -1,4 +1,4 @@
1
- import { Feature, FeatureCollection, MultiLineString, LineString, Properties } from "@turf/helpers";
1
+ import { Feature, FeatureCollection, MultiLineString, LineString, GeoJsonProperties } from "geojson";
2
2
  /**
3
3
  * Converts (Multi)LineString(s) to Polygon(s).
4
4
  *
@@ -19,9 +19,9 @@ import { Feature, FeatureCollection, MultiLineString, LineString, Properties } f
19
19
  * var addToMap = [polygon];
20
20
  */
21
21
  declare function lineToPolygon<G extends LineString | MultiLineString>(lines: Feature<G> | FeatureCollection<G> | G, options?: {
22
- properties?: Properties;
22
+ properties?: GeoJsonProperties;
23
23
  autoComplete?: boolean;
24
24
  orderCoords?: boolean;
25
25
  mutate?: boolean;
26
- }): Feature<import("@turf/helpers").MultiPolygon, Properties> | Feature<import("@turf/helpers").Polygon, Properties>;
26
+ }): Feature<import("geojson").MultiPolygon, GeoJsonProperties> | Feature<import("geojson").Polygon, GeoJsonProperties>;
27
27
  export default lineToPolygon;
package/dist/js/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var bbox_1 = __importDefault(require("@turf/bbox"));
7
- var invariant_1 = require("@turf/invariant");
8
- var helpers_1 = require("@turf/helpers");
9
- var clone_1 = __importDefault(require("@turf/clone"));
3
+ const tslib_1 = require("tslib");
4
+ const bbox_1 = tslib_1.__importDefault(require("@turf/bbox"));
5
+ const invariant_1 = require("@turf/invariant");
6
+ const helpers_1 = require("@turf/helpers");
7
+ const clone_1 = tslib_1.__importDefault(require("@turf/clone"));
10
8
  /**
11
9
  * Converts (Multi)LineString(s) to Polygon(s).
12
10
  *
@@ -26,8 +24,7 @@ var clone_1 = __importDefault(require("@turf/clone"));
26
24
  * //addToMap
27
25
  * var addToMap = [polygon];
28
26
  */
29
- function lineToPolygon(lines, options) {
30
- if (options === void 0) { options = {}; }
27
+ function lineToPolygon(lines, options = {}) {
31
28
  var _a, _b, _c;
32
29
  // Optional parameters
33
30
  var properties = options.properties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/line-to-polygon",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "turf line-to-polygon module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -31,6 +31,7 @@
31
31
  "exports": {
32
32
  "./package.json": "./package.json",
33
33
  ".": {
34
+ "types": "./dist/js/index.d.ts",
34
35
  "import": "./dist/es/index.js",
35
36
  "require": "./dist/js/index.js"
36
37
  }
@@ -41,14 +42,14 @@
41
42
  "dist"
42
43
  ],
43
44
  "scripts": {
44
- "bench": "ts-node bench.js",
45
+ "bench": "tsx bench.js",
45
46
  "build": "npm-run-all build:*",
46
47
  "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
47
48
  "build:js": "tsc",
48
- "docs": "node ../../scripts/generate-readmes",
49
+ "docs": "tsx ../../scripts/generate-readmes",
49
50
  "test": "npm-run-all test:*",
50
- "test:tape": "ts-node -r esm test.js",
51
- "test:types": "tsc --esModuleInterop --noEmit types.ts"
51
+ "test:tape": "tsx test.js",
52
+ "test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@types/tape": "*",
@@ -56,16 +57,17 @@
56
57
  "load-json-file": "*",
57
58
  "npm-run-all": "*",
58
59
  "tape": "*",
59
- "ts-node": "*",
60
60
  "tslint": "*",
61
+ "tsx": "*",
61
62
  "typescript": "*",
62
63
  "write-json-file": "*"
63
64
  },
64
65
  "dependencies": {
65
- "@turf/bbox": "^6.5.0",
66
- "@turf/clone": "^6.5.0",
67
- "@turf/helpers": "^6.5.0",
68
- "@turf/invariant": "^6.5.0"
66
+ "@turf/bbox": "^7.0.0-alpha.1",
67
+ "@turf/clone": "^7.0.0-alpha.1",
68
+ "@turf/helpers": "^7.0.0-alpha.1",
69
+ "@turf/invariant": "^7.0.0-alpha.1",
70
+ "tslib": "^2.3.0"
69
71
  },
70
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
72
+ "gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
71
73
  }