@turf/explode 7.0.0-alpha.0 → 7.0.0-alpha.110

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
@@ -33,26 +33,21 @@ Returns **[FeatureCollection][4]\<point>** points representing the exploded inpu
33
33
 
34
34
  [4]: https://tools.ietf.org/html/rfc7946#section-3.3
35
35
 
36
- <!-- This file is automatically generated. Please don't edit it directly:
37
- if you find an error, edit the source file (likely index.js), and re-run
38
- ./scripts/generate-readmes in the turf project. -->
36
+ <!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
39
37
 
40
38
  ---
41
39
 
42
- This module is part of the [Turfjs project](http://turfjs.org/), an open source
43
- module collection dedicated to geographic algorithms. It is maintained in the
44
- [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
45
- PRs and issues.
40
+ This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.
46
41
 
47
42
  ### Installation
48
43
 
49
- Install this module individually:
44
+ Install this single module individually:
50
45
 
51
46
  ```sh
52
47
  $ npm install @turf/explode
53
48
  ```
54
49
 
55
- Or install the Turf module that includes it as a function:
50
+ Or install the all-encompassing @turf/turf module that includes all modules as functions:
56
51
 
57
52
  ```sh
58
53
  $ npm install @turf/turf
@@ -0,0 +1,32 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // index.ts
5
+ var _meta = require('@turf/meta');
6
+ var _helpers = require('@turf/helpers');
7
+ function explode(geojson) {
8
+ const points = [];
9
+ if (geojson.type === "FeatureCollection") {
10
+ _meta.featureEach.call(void 0, geojson, function(feature) {
11
+ _meta.coordEach.call(void 0, feature, function(coord) {
12
+ points.push(_helpers.point.call(void 0, coord, feature.properties));
13
+ });
14
+ });
15
+ } else if (geojson.type === "Feature") {
16
+ _meta.coordEach.call(void 0, geojson, function(coord) {
17
+ points.push(_helpers.point.call(void 0, coord, geojson.properties));
18
+ });
19
+ } else {
20
+ _meta.coordEach.call(void 0, geojson, function(coord) {
21
+ points.push(_helpers.point.call(void 0, coord));
22
+ });
23
+ }
24
+ return _helpers.featureCollection.call(void 0, points);
25
+ }
26
+ __name(explode, "explode");
27
+ var turf_explode_default = explode;
28
+
29
+
30
+
31
+ exports.default = turf_explode_default; exports.explode = explode;
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,OAAO,yBAAyB;AAmBzC,SAAS,QAAQ,SAA+C;AAC9D,QAAM,SAA2B,CAAC;AAClC,MAAI,QAAQ,SAAS,qBAAqB;AACxC,gBAAY,SAAS,SAAU,SAAS;AACtC,gBAAU,SAAS,SAAU,OAAO;AAClC,eAAO,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,MAC9C,CAAC;AAAA,IACH,CAAC;AAAA,EACH,WAAW,QAAQ,SAAS,WAAW;AACrC,cAAU,SAAS,SAAU,OAAO;AAClC,aAAO,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,OAAO;AAEL,cAAU,SAAS,SAAU,OAAO;AAClC,aAAO,KAAK,MAAM,KAAK,CAAC;AAAA,IAC1B,CAAC;AAAA,EACH;AAEA,SAAO,kBAAkB,MAAM;AACjC;AApBS;AAuBT,IAAO,uBAAQ","sourcesContent":["import { coordEach, featureEach } from \"@turf/meta\";\nimport { point, featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type { Feature, FeatureCollection, Point } from \"geojson\";\n\n/**\n * Takes a feature or set of features and returns all positions as {@link Point|points}.\n *\n * @name explode\n * @param {GeoJSON} geojson input features\n * @returns {FeatureCollection<point>} points representing the exploded input features\n * @throws {Error} if it encounters an unknown geometry type\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var explode = turf.explode(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, explode]\n */\nfunction explode(geojson: AllGeoJSON): FeatureCollection<Point> {\n const points: Feature<Point>[] = [];\n if (geojson.type === \"FeatureCollection\") {\n featureEach(geojson, function (feature) {\n coordEach(feature, function (coord) {\n points.push(point(coord, feature.properties));\n });\n });\n } else if (geojson.type === \"Feature\") {\n coordEach(geojson, function (coord) {\n points.push(point(coord, geojson.properties));\n });\n } else {\n // No properties to copy.\n coordEach(geojson, function (coord) {\n points.push(point(coord));\n });\n }\n\n return featureCollection(points);\n}\n\nexport { explode };\nexport default explode;\n"]}
@@ -0,0 +1,21 @@
1
+ import { AllGeoJSON } from '@turf/helpers';
2
+ import { FeatureCollection, Point } from 'geojson';
3
+
4
+ /**
5
+ * Takes a feature or set of features and returns all positions as {@link Point|points}.
6
+ *
7
+ * @name explode
8
+ * @param {GeoJSON} geojson input features
9
+ * @returns {FeatureCollection<point>} points representing the exploded input features
10
+ * @throws {Error} if it encounters an unknown geometry type
11
+ * @example
12
+ * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);
13
+ *
14
+ * var explode = turf.explode(polygon);
15
+ *
16
+ * //addToMap
17
+ * var addToMap = [polygon, explode]
18
+ */
19
+ declare function explode(geojson: AllGeoJSON): FeatureCollection<Point>;
20
+
21
+ export { explode as default, explode };
@@ -0,0 +1,21 @@
1
+ import { AllGeoJSON } from '@turf/helpers';
2
+ import { FeatureCollection, Point } from 'geojson';
3
+
4
+ /**
5
+ * Takes a feature or set of features and returns all positions as {@link Point|points}.
6
+ *
7
+ * @name explode
8
+ * @param {GeoJSON} geojson input features
9
+ * @returns {FeatureCollection<point>} points representing the exploded input features
10
+ * @throws {Error} if it encounters an unknown geometry type
11
+ * @example
12
+ * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);
13
+ *
14
+ * var explode = turf.explode(polygon);
15
+ *
16
+ * //addToMap
17
+ * var addToMap = [polygon, explode]
18
+ */
19
+ declare function explode(geojson: AllGeoJSON): FeatureCollection<Point>;
20
+
21
+ export { explode as default, explode };
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // index.ts
5
+ import { coordEach, featureEach } from "@turf/meta";
6
+ import { point, featureCollection } from "@turf/helpers";
7
+ function explode(geojson) {
8
+ const points = [];
9
+ if (geojson.type === "FeatureCollection") {
10
+ featureEach(geojson, function(feature) {
11
+ coordEach(feature, function(coord) {
12
+ points.push(point(coord, feature.properties));
13
+ });
14
+ });
15
+ } else if (geojson.type === "Feature") {
16
+ coordEach(geojson, function(coord) {
17
+ points.push(point(coord, geojson.properties));
18
+ });
19
+ } else {
20
+ coordEach(geojson, function(coord) {
21
+ points.push(point(coord));
22
+ });
23
+ }
24
+ return featureCollection(points);
25
+ }
26
+ __name(explode, "explode");
27
+ var turf_explode_default = explode;
28
+ export {
29
+ turf_explode_default as default,
30
+ explode
31
+ };
32
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { coordEach, featureEach } from \"@turf/meta\";\nimport { point, featureCollection } from \"@turf/helpers\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport type { Feature, FeatureCollection, Point } from \"geojson\";\n\n/**\n * Takes a feature or set of features and returns all positions as {@link Point|points}.\n *\n * @name explode\n * @param {GeoJSON} geojson input features\n * @returns {FeatureCollection<point>} points representing the exploded input features\n * @throws {Error} if it encounters an unknown geometry type\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var explode = turf.explode(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, explode]\n */\nfunction explode(geojson: AllGeoJSON): FeatureCollection<Point> {\n const points: Feature<Point>[] = [];\n if (geojson.type === \"FeatureCollection\") {\n featureEach(geojson, function (feature) {\n coordEach(feature, function (coord) {\n points.push(point(coord, feature.properties));\n });\n });\n } else if (geojson.type === \"Feature\") {\n coordEach(geojson, function (coord) {\n points.push(point(coord, geojson.properties));\n });\n } else {\n // No properties to copy.\n coordEach(geojson, function (coord) {\n points.push(point(coord));\n });\n }\n\n return featureCollection(points);\n}\n\nexport { explode };\nexport default explode;\n"],"mappings":";;;;AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,OAAO,yBAAyB;AAmBzC,SAAS,QAAQ,SAA+C;AAC9D,QAAM,SAA2B,CAAC;AAClC,MAAI,QAAQ,SAAS,qBAAqB;AACxC,gBAAY,SAAS,SAAU,SAAS;AACtC,gBAAU,SAAS,SAAU,OAAO;AAClC,eAAO,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,MAC9C,CAAC;AAAA,IACH,CAAC;AAAA,EACH,WAAW,QAAQ,SAAS,WAAW;AACrC,cAAU,SAAS,SAAU,OAAO;AAClC,aAAO,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,OAAO;AAEL,cAAU,SAAS,SAAU,OAAO;AAClC,aAAO,KAAK,MAAM,KAAK,CAAC;AAAA,IAC1B,CAAC;AAAA,EACH;AAEA,SAAO,kBAAkB,MAAM;AACjC;AApBS;AAuBT,IAAO,uBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/explode",
3
- "version": "7.0.0-alpha.0",
3
+ "version": "7.0.0-alpha.110+1411d63a7",
4
4
  "description": "turf explode module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -22,40 +22,51 @@
22
22
  "geospatial",
23
23
  "coordinates"
24
24
  ],
25
- "main": "dist/js/index.js",
26
- "module": "dist/es/index.js",
25
+ "type": "commonjs",
26
+ "main": "dist/cjs/index.cjs",
27
+ "module": "dist/esm/index.mjs",
28
+ "types": "dist/cjs/index.d.ts",
27
29
  "exports": {
28
30
  "./package.json": "./package.json",
29
31
  ".": {
30
- "import": "./dist/es/index.js",
31
- "require": "./dist/js/index.js"
32
+ "import": {
33
+ "types": "./dist/esm/index.d.mts",
34
+ "default": "./dist/esm/index.mjs"
35
+ },
36
+ "require": {
37
+ "types": "./dist/cjs/index.d.ts",
38
+ "default": "./dist/cjs/index.cjs"
39
+ }
32
40
  }
33
41
  },
34
- "types": "index.d.ts",
35
42
  "sideEffects": false,
36
43
  "files": [
37
- "dist",
38
- "index.d.ts"
44
+ "dist"
39
45
  ],
40
46
  "scripts": {
41
- "bench": "node -r esm bench.js",
42
- "build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
43
- "docs": "node ../../scripts/generate-readmes",
44
- "test": "npm-run-all test:*",
45
- "test:tape": "node -r esm test.js"
47
+ "bench": "tsx bench.ts",
48
+ "build": "tsup --config ../../tsup.config.ts",
49
+ "docs": "tsx ../../scripts/generate-readmes.ts",
50
+ "test": "npm-run-all --npm-path npm test:*",
51
+ "test:tape": "tsx test.ts"
46
52
  },
47
53
  "devDependencies": {
48
- "benchmark": "*",
54
+ "@types/benchmark": "^2.1.5",
55
+ "@types/tape": "^4.2.32",
56
+ "benchmark": "^2.1.4",
49
57
  "geojson-fixtures": "*",
50
- "load-json-file": "*",
51
- "npm-run-all": "*",
52
- "rollup": "*",
53
- "tape": "*",
54
- "write-json-file": "*"
58
+ "load-json-file": "^7.0.1",
59
+ "npm-run-all": "^4.1.5",
60
+ "tape": "^5.7.2",
61
+ "tsup": "^8.0.1",
62
+ "tsx": "^4.6.2",
63
+ "typescript": "^5.2.2",
64
+ "write-json-file": "^5.0.0"
55
65
  },
56
66
  "dependencies": {
57
- "@turf/helpers": "^7.0.0-alpha.0",
58
- "@turf/meta": "^7.0.0-alpha.0"
67
+ "@turf/helpers": "^7.0.0-alpha.110+1411d63a7",
68
+ "@turf/meta": "^7.0.0-alpha.110+1411d63a7",
69
+ "tslib": "^2.6.2"
59
70
  },
60
- "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
71
+ "gitHead": "1411d63a74c275c9216fe48e9d3cb2d48a359068"
61
72
  }
package/dist/es/index.js DELETED
@@ -1,35 +0,0 @@
1
- import { featureEach, coordEach } from '@turf/meta';
2
- import { point, featureCollection } from '@turf/helpers';
3
-
4
- /**
5
- * Takes a feature or set of features and returns all positions as {@link Point|points}.
6
- *
7
- * @name explode
8
- * @param {GeoJSON} geojson input features
9
- * @returns {FeatureCollection<point>} points representing the exploded input features
10
- * @throws {Error} if it encounters an unknown geometry type
11
- * @example
12
- * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);
13
- *
14
- * var explode = turf.explode(polygon);
15
- *
16
- * //addToMap
17
- * var addToMap = [polygon, explode]
18
- */
19
- function explode(geojson) {
20
- var points = [];
21
- if (geojson.type === "FeatureCollection") {
22
- featureEach(geojson, function (feature) {
23
- coordEach(feature, function (coord) {
24
- points.push(point(coord, feature.properties));
25
- });
26
- });
27
- } else {
28
- coordEach(geojson, function (coord) {
29
- points.push(point(coord, geojson.properties));
30
- });
31
- }
32
- return featureCollection(points);
33
- }
34
-
35
- export default explode;
@@ -1 +0,0 @@
1
- {"type":"module"}
package/dist/js/index.js DELETED
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- var meta = require('@turf/meta');
4
- var helpers = require('@turf/helpers');
5
-
6
- /**
7
- * Takes a feature or set of features and returns all positions as {@link Point|points}.
8
- *
9
- * @name explode
10
- * @param {GeoJSON} geojson input features
11
- * @returns {FeatureCollection<point>} points representing the exploded input features
12
- * @throws {Error} if it encounters an unknown geometry type
13
- * @example
14
- * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);
15
- *
16
- * var explode = turf.explode(polygon);
17
- *
18
- * //addToMap
19
- * var addToMap = [polygon, explode]
20
- */
21
- function explode(geojson) {
22
- var points = [];
23
- if (geojson.type === "FeatureCollection") {
24
- meta.featureEach(geojson, function (feature) {
25
- meta.coordEach(feature, function (coord) {
26
- points.push(helpers.point(coord, feature.properties));
27
- });
28
- });
29
- } else {
30
- meta.coordEach(geojson, function (coord) {
31
- points.push(helpers.point(coord, geojson.properties));
32
- });
33
- }
34
- return helpers.featureCollection(points);
35
- }
36
-
37
- module.exports = explode;
38
- module.exports.default = explode;
package/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { FeatureCollection, Point } from "geojson";
2
- import { AllGeoJSON } from "@turf/helpers";
3
-
4
- /**
5
- * http://turfjs.org/docs/#explode
6
- */
7
- export default function explode(features: AllGeoJSON): FeatureCollection<Point>;