@turf/clusters 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,12 +6,12 @@
6
6
 
7
7
  Get Cluster
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `geojson` **[FeatureCollection][1]** GeoJSON Features
12
- - `filter` **any** Filter used on GeoJSON properties to get Cluster
11
+ * `geojson` **[FeatureCollection][1]** GeoJSON Features
12
+ * `filter` **any** Filter used on GeoJSON properties to get Cluster
13
13
 
14
- **Examples**
14
+ ### Examples
15
15
 
16
16
  ```javascript
17
17
  var geojson = turf.featureCollection([
@@ -44,11 +44,11 @@ Callback for clusterEach
44
44
 
45
45
  Type: [Function][2]
46
46
 
47
- **Parameters**
47
+ ### Parameters
48
48
 
49
- - `cluster` **[FeatureCollection][1]?** The current cluster being processed.
50
- - `clusterValue` **any?** Value used to create cluster being processed.
51
- - `currentIndex` **[number][3]?** The index of the current element being processed in the array.Starts at index 0
49
+ * `cluster` **[FeatureCollection][1]?** The current cluster being processed.
50
+ * `clusterValue` **any?** Value used to create cluster being processed.
51
+ * `currentIndex` **[number][3]?** The index of the current element being processed in the array.Starts at index 0
52
52
 
53
53
  Returns **void**
54
54
 
@@ -56,13 +56,13 @@ Returns **void**
56
56
 
57
57
  clusterEach
58
58
 
59
- **Parameters**
59
+ ### Parameters
60
60
 
61
- - `geojson` **[FeatureCollection][1]** GeoJSON Features
62
- - `property` **([string][4] \| [number][3])** GeoJSON property key/value used to create clusters
63
- - `callback` **[Function][2]** a method that takes (cluster, clusterValue, currentIndex)
61
+ * `geojson` **[FeatureCollection][1]** GeoJSON Features
62
+ * `property` **([string][4] | [number][3])** GeoJSON property key/value used to create clusters
63
+ * `callback` **[Function][2]** a method that takes (cluster, clusterValue, currentIndex)
64
64
 
65
- **Examples**
65
+ ### Examples
66
66
 
67
67
  ```javascript
68
68
  var geojson = turf.featureCollection([
@@ -107,37 +107,37 @@ on whether the reduce method has an initialValue argument.
107
107
 
108
108
  If an initialValue is provided to the reduce method:
109
109
 
110
- - The previousValue argument is initialValue.
111
- - The currentValue argument is the value of the first element present in the array.
110
+ * The previousValue argument is initialValue.
111
+ * The currentValue argument is the value of the first element present in the array.
112
112
 
113
113
  If an initialValue is not provided:
114
114
 
115
- - The previousValue argument is the value of the first element present in the array.
116
- - The currentValue argument is the value of the second element present in the array.
115
+ * The previousValue argument is the value of the first element present in the array.
116
+ * The currentValue argument is the value of the second element present in the array.
117
117
 
118
118
  Type: [Function][2]
119
119
 
120
- **Parameters**
120
+ ### Parameters
121
121
 
122
- - `previousValue` **any?** The accumulated value previously returned in the last invocation
122
+ * `previousValue` **any?** The accumulated value previously returned in the last invocation
123
123
  of the callback, or initialValue, if supplied.
124
- - `cluster` **[FeatureCollection][1]?** The current cluster being processed.
125
- - `clusterValue` **any?** Value used to create cluster being processed.
126
- - `currentIndex` **[number][3]?** The index of the current element being processed in the
124
+ * `cluster` **[FeatureCollection][1]?** The current cluster being processed.
125
+ * `clusterValue` **any?** Value used to create cluster being processed.
126
+ * `currentIndex` **[number][3]?** The index of the current element being processed in the
127
127
  array. Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
128
128
 
129
129
  ## clusterReduce
130
130
 
131
131
  Reduce clusters in GeoJSON Features, similar to Array.reduce()
132
132
 
133
- **Parameters**
133
+ ### Parameters
134
134
 
135
- - `geojson` **[FeatureCollection][1]** GeoJSON Features
136
- - `property` **([string][4] \| [number][3])** GeoJSON property key/value used to create clusters
137
- - `callback` **[Function][2]** a method that takes (previousValue, cluster, clusterValue, currentIndex)
138
- - `initialValue` **any?** Value to use as the first argument to the first call of the callback.
135
+ * `geojson` **[FeatureCollection][1]** GeoJSON Features
136
+ * `property` **([string][4] | [number][3])** GeoJSON property key/value used to create clusters
137
+ * `callback` **[Function][2]** a method that takes (previousValue, cluster, clusterValue, currentIndex)
138
+ * `initialValue` **any?** Value to use as the first argument to the first call of the callback.
139
139
 
140
- **Examples**
140
+ ### Examples
141
141
 
142
142
  ```javascript
143
143
  var geojson = turf.featureCollection([
package/dist/es/index.js CHANGED
File without changes
@@ -1,4 +1,4 @@
1
- import { FeatureCollection } from "@turf/helpers";
1
+ import { FeatureCollection, GeometryObject } from "geojson";
2
2
  /**
3
3
  * Get Cluster
4
4
  *
@@ -28,7 +28,7 @@ import { FeatureCollection } from "@turf/helpers";
28
28
  * turf.getCluster(clustered, {'marker-symbol': 'square'}).length;
29
29
  * //= 1
30
30
  */
31
- export declare function getCluster<G extends any, P = any>(geojson: FeatureCollection<G, P>, filter: any): FeatureCollection<G, P>;
31
+ export declare function getCluster<G extends GeometryObject, P = any>(geojson: FeatureCollection<G, P>, filter: any): FeatureCollection<G, P>;
32
32
  /**
33
33
  * Callback for clusterEach
34
34
  *
@@ -77,7 +77,7 @@ export declare function getCluster<G extends any, P = any>(geojson: FeatureColle
77
77
  * values.push(clusterValue);
78
78
  * });
79
79
  */
80
- export declare function clusterEach<G = any, P = any>(geojson: FeatureCollection<G, P>, property: number | string, callback: (cluster?: FeatureCollection<G, P>, clusterValue?: any, currentIndex?: number) => void): void;
80
+ export declare function clusterEach<G extends GeometryObject, P = any>(geojson: FeatureCollection<G, P>, property: number | string, callback: (cluster: FeatureCollection<G, P>, clusterValue?: any, currentIndex?: number) => void): void;
81
81
  /**
82
82
  * Callback for clusterReduce
83
83
  *
@@ -141,7 +141,7 @@ export declare function clusterEach<G = any, P = any>(geojson: FeatureCollection
141
141
  * return previousValue.concat(clusterValue);
142
142
  * }, []);
143
143
  */
144
- export declare function clusterReduce<G = any, P = any>(geojson: FeatureCollection<G, P>, property: number | string, callback: (previousValue?: any, cluster?: FeatureCollection<G, P>, clusterValue?: any, currentIndex?: number) => void, initialValue?: any): void;
144
+ export declare function clusterReduce<G extends GeometryObject, P = any>(geojson: FeatureCollection<G, P>, property: number | string, callback: (previousValue: any | undefined, cluster: FeatureCollection<G, P>, clusterValue?: any, currentIndex?: number) => void, initialValue?: any): void;
145
145
  /**
146
146
  * Create Bins
147
147
  *
package/dist/js/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var meta_1 = require("@turf/meta");
4
- var helpers_1 = require("@turf/helpers");
3
+ const meta_1 = require("@turf/meta");
4
+ const helpers_1 = require("@turf/helpers");
5
5
  /**
6
6
  * Get Cluster
7
7
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/clusters",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "turf clusters 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,27 +42,28 @@
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": "*",
55
56
  "benchmark": "*",
56
57
  "npm-run-all": "*",
57
58
  "tape": "*",
58
- "ts-node": "*",
59
59
  "tslint": "*",
60
+ "tsx": "*",
60
61
  "typescript": "*"
61
62
  },
62
63
  "dependencies": {
63
- "@turf/helpers": "^6.5.0",
64
- "@turf/meta": "^6.5.0"
64
+ "@turf/helpers": "^7.0.0-alpha.1",
65
+ "@turf/meta": "^7.0.0-alpha.1",
66
+ "tslib": "^2.3.0"
65
67
  },
66
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
68
+ "gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
67
69
  }