@turf/square-grid 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,18 +6,19 @@
6
6
 
7
7
  Creates a square grid from a bounding box.
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `bbox` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>** extent in [minX, minY, maxX, maxY] order
12
- - `cellSide` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** of each cell, in units
13
- - `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)
14
- - `options.units` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** used in calculating cellSide, can be degrees,
11
+ * `bbox` **[Array][1]<[number][2]>** extent in \[minX, minY, maxX, maxY] order
12
+ * `cellSide` **[number][2]** of each cell, in units
13
+ * `options` **[Object][3]** Optional parameters (optional, default `{}`)
14
+
15
+ * `options.units` **[string][4]** used in calculating cellSide, can be degrees,
15
16
  radians, miles, or kilometers (optional, default `'kilometers'`)
16
- - `options.mask` **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;([Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7))>?** if passed a Polygon or MultiPolygon,
17
+ * `options.mask` **[Feature][5]<([Polygon][6] | [MultiPolygon][7])>?** if passed a Polygon or MultiPolygon,
17
18
  the grid Points will be created only inside it
18
- - `options.properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** passed to each point of the grid (optional, default `{}`)
19
+ * `options.properties` **[Object][3]** passed to each point of the grid (optional, default `{}`)
19
20
 
20
- **Examples**
21
+ ### Examples
21
22
 
22
23
  ```javascript
23
24
  var bbox = [-95, 30 ,-85, 40];
@@ -30,7 +31,23 @@ var squareGrid = turf.squareGrid(bbox, cellSide, options);
30
31
  var addToMap = [squareGrid]
31
32
  ```
32
33
 
33
- Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)>** grid a grid of polygons
34
+ Returns **[FeatureCollection][8]<[Polygon][6]>** grid a grid of polygons
35
+
36
+ [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
37
+
38
+ [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
39
+
40
+ [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
41
+
42
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
43
+
44
+ [5]: https://tools.ietf.org/html/rfc7946#section-3.2
45
+
46
+ [6]: https://tools.ietf.org/html/rfc7946#section-3.1.6
47
+
48
+ [7]: https://tools.ietf.org/html/rfc7946#section-3.1.7
49
+
50
+ [8]: https://tools.ietf.org/html/rfc7946#section-3.3
34
51
 
35
52
  <!-- This file is automatically generated. Please don't edit it directly:
36
53
  if you find an error, edit the source file (likely index.js), and re-run
package/dist/es/index.js CHANGED
@@ -22,7 +22,6 @@ import rectangleGrid from "@turf/rectangle-grid";
22
22
  * //addToMap
23
23
  * var addToMap = [squareGrid]
24
24
  */
25
- export default function squareGrid(bbox, cellSide, options) {
26
- if (options === void 0) { options = {}; }
25
+ export default function squareGrid(bbox, cellSide, options = {}) {
27
26
  return rectangleGrid(bbox, cellSide, cellSide, options);
28
27
  }
@@ -1,4 +1,5 @@
1
- import { FeatureCollection, Polygon, BBox, Units, Feature, MultiPolygon, Properties } from "@turf/helpers";
1
+ import { FeatureCollection, Polygon, BBox, Feature, MultiPolygon, GeoJsonProperties } from "geojson";
2
+ import { Units } from "@turf/helpers";
2
3
  /**
3
4
  * Creates a square grid from a bounding box.
4
5
  *
@@ -22,7 +23,7 @@ import { FeatureCollection, Polygon, BBox, Units, Feature, MultiPolygon, Propert
22
23
  * //addToMap
23
24
  * var addToMap = [squareGrid]
24
25
  */
25
- export default function squareGrid<P = Properties>(bbox: BBox, cellSide: number, options?: {
26
+ export default function squareGrid<P = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
26
27
  units?: Units;
27
28
  properties?: P;
28
29
  mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
package/dist/js/index.js CHANGED
@@ -1,9 +1,7 @@
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 rectangle_grid_1 = __importDefault(require("@turf/rectangle-grid"));
3
+ const tslib_1 = require("tslib");
4
+ const rectangle_grid_1 = tslib_1.__importDefault(require("@turf/rectangle-grid"));
7
5
  /**
8
6
  * Creates a square grid from a bounding box.
9
7
  *
@@ -27,8 +25,7 @@ var rectangle_grid_1 = __importDefault(require("@turf/rectangle-grid"));
27
25
  * //addToMap
28
26
  * var addToMap = [squareGrid]
29
27
  */
30
- function squareGrid(bbox, cellSide, options) {
31
- if (options === void 0) { options = {}; }
28
+ function squareGrid(bbox, cellSide, options = {}) {
32
29
  return rectangle_grid_1.default(bbox, cellSide, cellSide, options);
33
30
  }
34
31
  exports.default = squareGrid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/square-grid",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "turf square-grid module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -28,6 +28,7 @@
28
28
  "exports": {
29
29
  "./package.json": "./package.json",
30
30
  ".": {
31
+ "types": "./dist/js/index.d.ts",
31
32
  "import": "./dist/es/index.js",
32
33
  "require": "./dist/js/index.js"
33
34
  }
@@ -38,29 +39,30 @@
38
39
  "dist"
39
40
  ],
40
41
  "scripts": {
41
- "bench": "ts-node bench.js",
42
+ "bench": "tsx bench.js",
42
43
  "build": "npm-run-all build:*",
43
44
  "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
44
45
  "build:js": "tsc",
45
- "docs": "node ../../scripts/generate-readmes",
46
+ "docs": "tsx ../../scripts/generate-readmes",
46
47
  "test": "npm-run-all test:*",
47
- "test:tape": "ts-node -r esm test.js"
48
+ "test:tape": "tsx test.js"
48
49
  },
49
50
  "devDependencies": {
50
- "@turf/bbox-polygon": "^6.5.0",
51
- "@turf/truncate": "^6.5.0",
51
+ "@turf/bbox-polygon": "^7.0.0-alpha.1",
52
+ "@turf/truncate": "^7.0.0-alpha.1",
52
53
  "@types/tape": "*",
53
54
  "benchmark": "*",
54
55
  "npm-run-all": "*",
55
56
  "tape": "*",
56
- "ts-node": "*",
57
57
  "tslint": "*",
58
+ "tsx": "*",
58
59
  "typescript": "*",
59
60
  "write-json-file": "*"
60
61
  },
61
62
  "dependencies": {
62
- "@turf/helpers": "^6.5.0",
63
- "@turf/rectangle-grid": "^6.5.0"
63
+ "@turf/helpers": "^7.0.0-alpha.1",
64
+ "@turf/rectangle-grid": "^7.0.0-alpha.1",
65
+ "tslib": "^2.3.0"
64
66
  },
65
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
67
+ "gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
66
68
  }