@turf/combine 6.5.0 → 7.0.0-alpha.0

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
@@ -7,11 +7,11 @@
7
7
  Combines a [FeatureCollection][1] of [Point][2], [LineString][3], or [Polygon][4] features
8
8
  into [MultiPoint][5], [MultiLineString][6], or [MultiPolygon][7] features.
9
9
 
10
- **Parameters**
10
+ ### Parameters
11
11
 
12
- - `fc` **[FeatureCollection][8]<([Point][9] \| [LineString][10] \| [Polygon][11])>** a FeatureCollection of any type
12
+ * `fc` **[FeatureCollection][8]<([Point][9] | [LineString][10] | [Polygon][11])>** a FeatureCollection of any type
13
13
 
14
- **Examples**
14
+ ### Examples
15
15
 
16
16
  ```javascript
17
17
  var fc = turf.featureCollection([
@@ -25,7 +25,7 @@ var combined = turf.combine(fc);
25
25
  var addToMap = [combined]
26
26
  ```
27
27
 
28
- Returns **[FeatureCollection][8]&lt;([MultiPoint][12] \| [MultiLineString][13] \| [MultiPolygon][14])>** a FeatureCollection of corresponding type to input
28
+ Returns **[FeatureCollection][8]<([MultiPoint][12] | [MultiLineString][13] | [MultiPolygon][14])>** a FeatureCollection of corresponding type to input
29
29
 
30
30
  [1]: https://tools.ietf.org/html/rfc7946#section-3.3
31
31
 
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { feature, featureCollection, } from "@turf/helpers";
1
+ import { feature, featureCollection } from "@turf/helpers";
2
2
  import { featureEach } from "@turf/meta";
3
3
  /**
4
4
  * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
@@ -33,16 +33,15 @@ function combine(fc) {
33
33
  properties: [],
34
34
  },
35
35
  };
36
- featureEach(fc, function (feature) {
37
- var _a, _b, _c;
38
- var _d;
39
- switch ((_d = feature.geometry) === null || _d === void 0 ? void 0 : _d.type) {
36
+ featureEach(fc, (feature) => {
37
+ var _a;
38
+ switch ((_a = feature.geometry) === null || _a === void 0 ? void 0 : _a.type) {
40
39
  case "Point":
41
40
  groups.MultiPoint.coordinates.push(feature.geometry.coordinates);
42
41
  groups.MultiPoint.properties.push(feature.properties);
43
42
  break;
44
43
  case "MultiPoint":
45
- (_a = groups.MultiPoint.coordinates).push.apply(_a, feature.geometry.coordinates);
44
+ groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);
46
45
  groups.MultiPoint.properties.push(feature.properties);
47
46
  break;
48
47
  case "LineString":
@@ -50,7 +49,7 @@ function combine(fc) {
50
49
  groups.MultiLineString.properties.push(feature.properties);
51
50
  break;
52
51
  case "MultiLineString":
53
- (_b = groups.MultiLineString.coordinates).push.apply(_b, feature.geometry.coordinates);
52
+ groups.MultiLineString.coordinates.push(...feature.geometry.coordinates);
54
53
  groups.MultiLineString.properties.push(feature.properties);
55
54
  break;
56
55
  case "Polygon":
@@ -58,7 +57,7 @@ function combine(fc) {
58
57
  groups.MultiPolygon.properties.push(feature.properties);
59
58
  break;
60
59
  case "MultiPolygon":
61
- (_c = groups.MultiPolygon.coordinates).push.apply(_c, feature.geometry.coordinates);
60
+ groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);
62
61
  groups.MultiPolygon.properties.push(feature.properties);
63
62
  break;
64
63
  default:
@@ -1,5 +1,4 @@
1
- import { MultiLineString, MultiPoint, MultiPolygon, Properties } from "@turf/helpers";
2
- import { Point, LineString, Polygon, FeatureCollection } from "@turf/helpers";
1
+ import { GeoJsonProperties, FeatureCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from "geojson";
3
2
  /**
4
3
  * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
5
4
  * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.
@@ -18,10 +17,7 @@ import { Point, LineString, Polygon, FeatureCollection } from "@turf/helpers";
18
17
  * //addToMap
19
18
  * var addToMap = [combined]
20
19
  */
21
- declare function combine(fc: FeatureCollection<Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon>): FeatureCollection<{
22
- type: "MultiPoint" | "MultiLineString" | "MultiPolygon";
23
- coordinates: number[][] | number[][][] | number[][][][];
24
- }, {
25
- collectedProperties: Properties[];
20
+ declare function combine(fc: FeatureCollection<Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon>): FeatureCollection<MultiPoint | MultiLineString | MultiPolygon, {
21
+ collectedProperties: GeoJsonProperties[];
26
22
  }>;
27
23
  export default combine;
package/dist/js/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var helpers_1 = require("@turf/helpers");
4
- var meta_1 = require("@turf/meta");
3
+ const helpers_1 = require("@turf/helpers");
4
+ const meta_1 = require("@turf/meta");
5
5
  /**
6
6
  * Combines a {@link FeatureCollection} of {@link Point}, {@link LineString}, or {@link Polygon} features
7
7
  * into {@link MultiPoint}, {@link MultiLineString}, or {@link MultiPolygon} features.
@@ -35,16 +35,15 @@ function combine(fc) {
35
35
  properties: [],
36
36
  },
37
37
  };
38
- meta_1.featureEach(fc, function (feature) {
39
- var _a, _b, _c;
40
- var _d;
41
- switch ((_d = feature.geometry) === null || _d === void 0 ? void 0 : _d.type) {
38
+ meta_1.featureEach(fc, (feature) => {
39
+ var _a;
40
+ switch ((_a = feature.geometry) === null || _a === void 0 ? void 0 : _a.type) {
42
41
  case "Point":
43
42
  groups.MultiPoint.coordinates.push(feature.geometry.coordinates);
44
43
  groups.MultiPoint.properties.push(feature.properties);
45
44
  break;
46
45
  case "MultiPoint":
47
- (_a = groups.MultiPoint.coordinates).push.apply(_a, feature.geometry.coordinates);
46
+ groups.MultiPoint.coordinates.push(...feature.geometry.coordinates);
48
47
  groups.MultiPoint.properties.push(feature.properties);
49
48
  break;
50
49
  case "LineString":
@@ -52,7 +51,7 @@ function combine(fc) {
52
51
  groups.MultiLineString.properties.push(feature.properties);
53
52
  break;
54
53
  case "MultiLineString":
55
- (_b = groups.MultiLineString.coordinates).push.apply(_b, feature.geometry.coordinates);
54
+ groups.MultiLineString.coordinates.push(...feature.geometry.coordinates);
56
55
  groups.MultiLineString.properties.push(feature.properties);
57
56
  break;
58
57
  case "Polygon":
@@ -60,7 +59,7 @@ function combine(fc) {
60
59
  groups.MultiPolygon.properties.push(feature.properties);
61
60
  break;
62
61
  case "MultiPolygon":
63
- (_c = groups.MultiPolygon.coordinates).push.apply(_c, feature.geometry.coordinates);
62
+ groups.MultiPolygon.coordinates.push(...feature.geometry.coordinates);
64
63
  groups.MultiPolygon.properties.push(feature.properties);
65
64
  break;
66
65
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/combine",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf combine module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -56,8 +56,9 @@
56
56
  "typescript": "*"
57
57
  },
58
58
  "dependencies": {
59
- "@turf/helpers": "^6.5.0",
60
- "@turf/meta": "^6.5.0"
59
+ "@turf/helpers": "^7.0.0-alpha.0",
60
+ "@turf/meta": "^7.0.0-alpha.0",
61
+ "tslib": "^2.3.0"
61
62
  },
62
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
63
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
63
64
  }