@turf/kinks 7.0.0-alpha.113 → 7.0.0-alpha.114

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.
@@ -2,8 +2,13 @@
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // index.ts
5
- var _sweeplineintersections = require('sweepline-intersections'); var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
6
5
  var _helpers = require('@turf/helpers');
6
+
7
+ // lib/sweepline-intersections-export.ts
8
+ var _sweeplineintersections = require('sweepline-intersections'); var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
9
+ var sweeplineIntersections = _sweeplineintersections2.default;
10
+
11
+ // index.ts
7
12
  function kinks(featureIn) {
8
13
  const results = {
9
14
  type: "FeatureCollection",
@@ -14,7 +19,7 @@ function kinks(featureIn) {
14
19
  "Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry"
15
20
  );
16
21
  }
17
- const intersections = _sweeplineintersections2.default.call(void 0, featureIn, false);
22
+ const intersections = sweeplineIntersections(featureIn, false);
18
23
  for (let i = 0; i < intersections.length; ++i) {
19
24
  const intersection = intersections[i];
20
25
  results.features.push(_helpers.point.call(void 0, [intersection[0], intersection[1]]));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AASA,OAAO,uBAAuB;AAC9B,SAAS,aAAa;AAwBtB,SAAS,MACP,WAC0B;AAC1B,QAAM,UAAoC;AAAA,IACxC,MAAM;AAAA,IACN,UAAU,CAAC;AAAA,EACb;AACA,MACE,UAAU,SAAS,cACjB,UAAsB,SAAS,SAAS,WACvC,UAAsB,SAAS,SAAS,eAC3C;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,QAAM,gBAAgB,kBAAkB,WAAW,KAAK;AACxD,WAAS,IAAI,GAAG,IAAI,cAAc,QAAQ,EAAE,GAAG;AAC7C,UAAM,eAAe,cAAc,CAAC;AACpC,YAAQ,SAAS,KAAK,MAAM,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAvBS;AA0BT,IAAO,qBAAQ","sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport findIntersections from \"sweepline-intersections\";\nimport { point } from \"@turf/helpers\";\n\n/**\n * Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},\n * {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and\n * returns {@link Point|points} at all self-intersections.\n *\n * @name kinks\n * @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature\n * @returns {FeatureCollection<Point>} self-intersections\n * @example\n * var poly = turf.polygon([[\n * [-12.034835, 8.901183],\n * [-12.060413, 8.899826],\n * [-12.03638, 8.873199],\n * [-12.059383, 8.871418],\n * [-12.034835, 8.901183]\n * ]]);\n *\n * var kinks = turf.kinks(poly);\n *\n * //addToMap\n * var addToMap = [poly, kinks]\n */\nfunction kinks<T extends LineString | MultiLineString | Polygon | MultiPolygon>(\n featureIn: Feature<T>\n): FeatureCollection<Point> {\n const results: FeatureCollection<Point> = {\n type: \"FeatureCollection\",\n features: [],\n };\n if (\n featureIn.type === \"Feature\" &&\n ((featureIn as Feature).geometry.type === \"Point\" ||\n (featureIn as Feature).geometry.type === \"MultiPoint\")\n ) {\n throw new Error(\n \"Input must be a LineString, MultiLineString, \" +\n \"Polygon, or MultiPolygon Feature or Geometry\"\n );\n }\n const intersections = findIntersections(featureIn, false);\n for (let i = 0; i < intersections.length; ++i) {\n const intersection = intersections[i];\n results.features.push(point([intersection[0], intersection[1]]));\n }\n return results;\n}\n\nexport { kinks };\nexport default kinks;\n"]}
1
+ {"version":3,"sources":["../../index.ts","../../lib/sweepline-intersections-export.ts"],"names":[],"mappings":";;;;AASA,SAAS,aAAa;;;ACLtB,OAAO,SAAS;AAET,IAAM,yBAAyB;;;AD4BtC,SAAS,MACP,WAC0B;AAC1B,QAAM,UAAoC;AAAA,IACxC,MAAM;AAAA,IACN,UAAU,CAAC;AAAA,EACb;AACA,MACE,UAAU,SAAS,cACjB,UAAsB,SAAS,SAAS,WACvC,UAAsB,SAAS,SAAS,eAC3C;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,QAAM,gBAAgB,uBAAkB,WAAW,KAAK;AACxD,WAAS,IAAI,GAAG,IAAI,cAAc,QAAQ,EAAE,GAAG;AAC7C,UAAM,eAAe,cAAc,CAAC;AACpC,YAAQ,SAAS,KAAK,MAAM,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAvBS;AA0BT,IAAO,qBAAQ","sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { point } from \"@turf/helpers\";\nimport { sweeplineIntersections as findIntersections } from \"./lib/sweepline-intersections-export.js\";\n\n/**\n * Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},\n * {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and\n * returns {@link Point|points} at all self-intersections.\n *\n * @name kinks\n * @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature\n * @returns {FeatureCollection<Point>} self-intersections\n * @example\n * var poly = turf.polygon([[\n * [-12.034835, 8.901183],\n * [-12.060413, 8.899826],\n * [-12.03638, 8.873199],\n * [-12.059383, 8.871418],\n * [-12.034835, 8.901183]\n * ]]);\n *\n * var kinks = turf.kinks(poly);\n *\n * //addToMap\n * var addToMap = [poly, kinks]\n */\nfunction kinks<T extends LineString | MultiLineString | Polygon | MultiPolygon>(\n featureIn: Feature<T>\n): FeatureCollection<Point> {\n const results: FeatureCollection<Point> = {\n type: \"FeatureCollection\",\n features: [],\n };\n if (\n featureIn.type === \"Feature\" &&\n ((featureIn as Feature).geometry.type === \"Point\" ||\n (featureIn as Feature).geometry.type === \"MultiPoint\")\n ) {\n throw new Error(\n \"Input must be a LineString, MultiLineString, \" +\n \"Polygon, or MultiPolygon Feature or Geometry\"\n );\n }\n const intersections = findIntersections(featureIn, false);\n for (let i = 0; i < intersections.length; ++i) {\n const intersection = intersections[i];\n results.features.push(point([intersection[0], intersection[1]]));\n }\n return results;\n}\n\nexport { kinks };\nexport default kinks;\n","// Get around problems with moduleResolution node16 and some older libraries.\n// Manifests as \"This expression is not callable ... has no call signatures\"\n// https://stackoverflow.com/a/74709714\n\nimport lib from \"sweepline-intersections\";\n\nexport const sweeplineIntersections = lib as unknown as typeof lib.default;\n"]}
@@ -2,8 +2,13 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // index.ts
5
- import findIntersections from "sweepline-intersections";
6
5
  import { point } from "@turf/helpers";
6
+
7
+ // lib/sweepline-intersections-export.ts
8
+ import lib from "sweepline-intersections";
9
+ var sweeplineIntersections = lib;
10
+
11
+ // index.ts
7
12
  function kinks(featureIn) {
8
13
  const results = {
9
14
  type: "FeatureCollection",
@@ -14,7 +19,7 @@ function kinks(featureIn) {
14
19
  "Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry"
15
20
  );
16
21
  }
17
- const intersections = findIntersections(featureIn, false);
22
+ const intersections = sweeplineIntersections(featureIn, false);
18
23
  for (let i = 0; i < intersections.length; ++i) {
19
24
  const intersection = intersections[i];
20
25
  results.features.push(point([intersection[0], intersection[1]]));
@@ -27,4 +32,4 @@ export {
27
32
  turf_kinks_default as default,
28
33
  kinks
29
34
  };
30
- //# sourceMappingURL=index.mjs.map
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts","../../lib/sweepline-intersections-export.ts"],"sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { point } from \"@turf/helpers\";\nimport { sweeplineIntersections as findIntersections } from \"./lib/sweepline-intersections-export.js\";\n\n/**\n * Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},\n * {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and\n * returns {@link Point|points} at all self-intersections.\n *\n * @name kinks\n * @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature\n * @returns {FeatureCollection<Point>} self-intersections\n * @example\n * var poly = turf.polygon([[\n * [-12.034835, 8.901183],\n * [-12.060413, 8.899826],\n * [-12.03638, 8.873199],\n * [-12.059383, 8.871418],\n * [-12.034835, 8.901183]\n * ]]);\n *\n * var kinks = turf.kinks(poly);\n *\n * //addToMap\n * var addToMap = [poly, kinks]\n */\nfunction kinks<T extends LineString | MultiLineString | Polygon | MultiPolygon>(\n featureIn: Feature<T>\n): FeatureCollection<Point> {\n const results: FeatureCollection<Point> = {\n type: \"FeatureCollection\",\n features: [],\n };\n if (\n featureIn.type === \"Feature\" &&\n ((featureIn as Feature).geometry.type === \"Point\" ||\n (featureIn as Feature).geometry.type === \"MultiPoint\")\n ) {\n throw new Error(\n \"Input must be a LineString, MultiLineString, \" +\n \"Polygon, or MultiPolygon Feature or Geometry\"\n );\n }\n const intersections = findIntersections(featureIn, false);\n for (let i = 0; i < intersections.length; ++i) {\n const intersection = intersections[i];\n results.features.push(point([intersection[0], intersection[1]]));\n }\n return results;\n}\n\nexport { kinks };\nexport default kinks;\n","// Get around problems with moduleResolution node16 and some older libraries.\n// Manifests as \"This expression is not callable ... has no call signatures\"\n// https://stackoverflow.com/a/74709714\n\nimport lib from \"sweepline-intersections\";\n\nexport const sweeplineIntersections = lib as unknown as typeof lib.default;\n"],"mappings":";;;;AASA,SAAS,aAAa;;;ACLtB,OAAO,SAAS;AAET,IAAM,yBAAyB;;;AD4BtC,SAAS,MACP,WAC0B;AAC1B,QAAM,UAAoC;AAAA,IACxC,MAAM;AAAA,IACN,UAAU,CAAC;AAAA,EACb;AACA,MACE,UAAU,SAAS,cACjB,UAAsB,SAAS,SAAS,WACvC,UAAsB,SAAS,SAAS,eAC3C;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,QAAM,gBAAgB,uBAAkB,WAAW,KAAK;AACxD,WAAS,IAAI,GAAG,IAAI,cAAc,QAAQ,EAAE,GAAG;AAC7C,UAAM,eAAe,cAAc,CAAC;AACpC,YAAQ,SAAS,KAAK,MAAM,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAvBS;AA0BT,IAAO,qBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/kinks",
3
- "version": "7.0.0-alpha.113+876702a45",
3
+ "version": "7.0.0-alpha.114+e0bdd0add",
4
4
  "description": "turf kinks module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -21,19 +21,19 @@
21
21
  "kinks",
22
22
  "self-intersection"
23
23
  ],
24
- "type": "commonjs",
24
+ "type": "module",
25
25
  "main": "dist/cjs/index.cjs",
26
- "module": "dist/esm/index.mjs",
27
- "types": "dist/cjs/index.d.ts",
26
+ "module": "dist/esm/index.js",
27
+ "types": "dist/esm/index.d.ts",
28
28
  "exports": {
29
29
  "./package.json": "./package.json",
30
30
  ".": {
31
31
  "import": {
32
- "types": "./dist/esm/index.d.mts",
33
- "default": "./dist/esm/index.mjs"
32
+ "types": "./dist/esm/index.d.ts",
33
+ "default": "./dist/esm/index.js"
34
34
  },
35
35
  "require": {
36
- "types": "./dist/cjs/index.d.ts",
36
+ "types": "./dist/cjs/index.d.cts",
37
37
  "default": "./dist/cjs/index.cjs"
38
38
  }
39
39
  }
@@ -48,10 +48,10 @@
48
48
  "docs": "tsx ../../scripts/generate-readmes.ts",
49
49
  "test": "npm-run-all --npm-path npm test:*",
50
50
  "test:tape": "tsx test.ts",
51
- "test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
51
+ "test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
52
52
  },
53
53
  "devDependencies": {
54
- "@turf/meta": "^7.0.0-alpha.113+876702a45",
54
+ "@turf/meta": "^7.0.0-alpha.114+e0bdd0add",
55
55
  "@types/benchmark": "^2.1.5",
56
56
  "@types/tape": "^4.2.32",
57
57
  "benchmark": "^2.1.4",
@@ -64,9 +64,9 @@
64
64
  "write-json-file": "^5.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "@turf/helpers": "^7.0.0-alpha.113+876702a45",
67
+ "@turf/helpers": "^7.0.0-alpha.114+e0bdd0add",
68
68
  "sweepline-intersections": "^1.5.0",
69
69
  "tslib": "^2.6.2"
70
70
  },
71
- "gitHead": "876702a454d5d085d6e1e54ae286c2b5bc08f584"
71
+ "gitHead": "e0bdd0add87f21a4430f8884736096d1ac6fe4cd"
72
72
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport findIntersections from \"sweepline-intersections\";\nimport { point } from \"@turf/helpers\";\n\n/**\n * Takes a {@link LineString|linestring}, {@link MultiLineString|multi-linestring},\n * {@link MultiPolygon|multi-polygon} or {@link Polygon|polygon} and\n * returns {@link Point|points} at all self-intersections.\n *\n * @name kinks\n * @param {Feature<LineString|MultiLineString|MultiPolygon|Polygon>} featureIn input feature\n * @returns {FeatureCollection<Point>} self-intersections\n * @example\n * var poly = turf.polygon([[\n * [-12.034835, 8.901183],\n * [-12.060413, 8.899826],\n * [-12.03638, 8.873199],\n * [-12.059383, 8.871418],\n * [-12.034835, 8.901183]\n * ]]);\n *\n * var kinks = turf.kinks(poly);\n *\n * //addToMap\n * var addToMap = [poly, kinks]\n */\nfunction kinks<T extends LineString | MultiLineString | Polygon | MultiPolygon>(\n featureIn: Feature<T>\n): FeatureCollection<Point> {\n const results: FeatureCollection<Point> = {\n type: \"FeatureCollection\",\n features: [],\n };\n if (\n featureIn.type === \"Feature\" &&\n ((featureIn as Feature).geometry.type === \"Point\" ||\n (featureIn as Feature).geometry.type === \"MultiPoint\")\n ) {\n throw new Error(\n \"Input must be a LineString, MultiLineString, \" +\n \"Polygon, or MultiPolygon Feature or Geometry\"\n );\n }\n const intersections = findIntersections(featureIn, false);\n for (let i = 0; i < intersections.length; ++i) {\n const intersection = intersections[i];\n results.features.push(point([intersection[0], intersection[1]]));\n }\n return results;\n}\n\nexport { kinks };\nexport default kinks;\n"],"mappings":";;;;AASA,OAAO,uBAAuB;AAC9B,SAAS,aAAa;AAwBtB,SAAS,MACP,WAC0B;AAC1B,QAAM,UAAoC;AAAA,IACxC,MAAM;AAAA,IACN,UAAU,CAAC;AAAA,EACb;AACA,MACE,UAAU,SAAS,cACjB,UAAsB,SAAS,SAAS,WACvC,UAAsB,SAAS,SAAS,eAC3C;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,QAAM,gBAAgB,kBAAkB,WAAW,KAAK;AACxD,WAAS,IAAI,GAAG,IAAI,cAAc,QAAQ,EAAE,GAAG;AAC7C,UAAM,eAAe,cAAc,CAAC;AACpC,YAAQ,SAAS,KAAK,MAAM,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAAA,EACjE;AACA,SAAO;AACT;AAvBS;AA0BT,IAAO,qBAAQ;","names":[]}
File without changes
File without changes