@turf/square-grid 7.0.0-alpha.2 → 7.1.0-alpha.7

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
@@ -49,26 +49,21 @@ Returns **[FeatureCollection][8]<[Polygon][6]>** grid a grid of polygons
49
49
 
50
50
  [8]: https://tools.ietf.org/html/rfc7946#section-3.3
51
51
 
52
- <!-- This file is automatically generated. Please don't edit it directly:
53
- if you find an error, edit the source file (likely index.js), and re-run
54
- ./scripts/generate-readmes in the turf project. -->
52
+ <!-- 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. -->
55
53
 
56
54
  ---
57
55
 
58
- This module is part of the [Turfjs project](http://turfjs.org/), an open source
59
- module collection dedicated to geographic algorithms. It is maintained in the
60
- [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
61
- PRs and issues.
56
+ 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.
62
57
 
63
58
  ### Installation
64
59
 
65
- Install this module individually:
60
+ Install this single module individually:
66
61
 
67
62
  ```sh
68
63
  $ npm install @turf/square-grid
69
64
  ```
70
65
 
71
- Or install the Turf module that includes it as a function:
66
+ Or install the all-encompassing @turf/turf module that includes all modules as functions:
72
67
 
73
68
  ```sh
74
69
  $ npm install @turf/turf
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
2
+ var _rectanglegrid = require('@turf/rectangle-grid');
3
+ function squareGrid(bbox, cellSide, options = {}) {
4
+ return _rectanglegrid.rectangleGrid.call(void 0, bbox, cellSide, cellSide, options);
5
+ }
6
+ var turf_square_grid_default = squareGrid;
7
+
8
+
9
+
10
+ exports.default = turf_square_grid_default; exports.squareGrid = squareGrid;
11
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AASA,SAAS,qBAAqB;AA0B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAGA,IAAO,2BAAQ","sourcesContent":["import {\n FeatureCollection,\n Polygon,\n BBox,\n Feature,\n MultiPolygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { rectangleGrid } from \"@turf/rectangle-grid\";\n\n/**\n * Creates a square grid from a bounding box.\n *\n * @name squareGrid\n * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order\n * @param {number} cellSide of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,\n * radians, miles, or kilometers\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} grid a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellSide = 50;\n * var options = {units: 'miles'};\n *\n * var squareGrid = turf.squareGrid(bbox, cellSide, options);\n *\n * //addToMap\n * var addToMap = [squareGrid]\n */\n\nfunction squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellSide: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n return rectangleGrid(bbox, cellSide, cellSide, options);\n}\n\nexport { squareGrid };\nexport default squareGrid;\n"]}
@@ -1,4 +1,6 @@
1
- import rectangleGrid from "@turf/rectangle-grid";
1
+ import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollection } from 'geojson';
2
+ import { Units } from '@turf/helpers';
3
+
2
4
  /**
3
5
  * Creates a square grid from a bounding box.
4
6
  *
@@ -22,6 +24,10 @@ import rectangleGrid from "@turf/rectangle-grid";
22
24
  * //addToMap
23
25
  * var addToMap = [squareGrid]
24
26
  */
25
- export default function squareGrid(bbox, cellSide, options = {}) {
26
- return rectangleGrid(bbox, cellSide, cellSide, options);
27
- }
27
+ declare function squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
28
+ units?: Units;
29
+ properties?: P;
30
+ mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
31
+ }): FeatureCollection<Polygon, P>;
32
+
33
+ export { squareGrid as default, squareGrid };
@@ -1,5 +1,6 @@
1
- import { FeatureCollection, Polygon, BBox, Feature, MultiPolygon, GeoJsonProperties } from "geojson";
2
- import { Units } from "@turf/helpers";
1
+ import { GeoJsonProperties, BBox, Feature, Polygon, MultiPolygon, FeatureCollection } from 'geojson';
2
+ import { Units } from '@turf/helpers';
3
+
3
4
  /**
4
5
  * Creates a square grid from a bounding box.
5
6
  *
@@ -23,8 +24,10 @@ import { Units } from "@turf/helpers";
23
24
  * //addToMap
24
25
  * var addToMap = [squareGrid]
25
26
  */
26
- export default function squareGrid<P = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
27
+ declare function squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(bbox: BBox, cellSide: number, options?: {
27
28
  units?: Units;
28
29
  properties?: P;
29
30
  mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;
30
31
  }): FeatureCollection<Polygon, P>;
32
+
33
+ export { squareGrid as default, squareGrid };
@@ -0,0 +1,11 @@
1
+ // index.ts
2
+ import { rectangleGrid } from "@turf/rectangle-grid";
3
+ function squareGrid(bbox, cellSide, options = {}) {
4
+ return rectangleGrid(bbox, cellSide, cellSide, options);
5
+ }
6
+ var turf_square_grid_default = squareGrid;
7
+ export {
8
+ turf_square_grid_default as default,
9
+ squareGrid
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n FeatureCollection,\n Polygon,\n BBox,\n Feature,\n MultiPolygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport { Units } from \"@turf/helpers\";\nimport { rectangleGrid } from \"@turf/rectangle-grid\";\n\n/**\n * Creates a square grid from a bounding box.\n *\n * @name squareGrid\n * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order\n * @param {number} cellSide of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,\n * radians, miles, or kilometers\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} grid a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellSide = 50;\n * var options = {units: 'miles'};\n *\n * var squareGrid = turf.squareGrid(bbox, cellSide, options);\n *\n * //addToMap\n * var addToMap = [squareGrid]\n */\n\nfunction squareGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellSide: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n return rectangleGrid(bbox, cellSide, cellSide, options);\n}\n\nexport { squareGrid };\nexport default squareGrid;\n"],"mappings":";AASA,SAAS,qBAAqB;AA0B9B,SAAS,WACP,MACA,UACA,UAII,CAAC,GAC0B;AAC/B,SAAO,cAAc,MAAM,UAAU,UAAU,OAAO;AACxD;AAGA,IAAO,2BAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/square-grid",
3
- "version": "7.0.0-alpha.2",
3
+ "version": "7.1.0-alpha.7+0ce6ecca0",
4
4
  "description": "turf square-grid module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -23,46 +23,51 @@
23
23
  "cartesian",
24
24
  "grid"
25
25
  ],
26
- "main": "dist/js/index.js",
27
- "module": "dist/es/index.js",
26
+ "type": "module",
27
+ "main": "dist/cjs/index.cjs",
28
+ "module": "dist/esm/index.js",
29
+ "types": "dist/esm/index.d.ts",
28
30
  "exports": {
29
31
  "./package.json": "./package.json",
30
32
  ".": {
31
- "types": "./dist/js/index.d.ts",
32
- "import": "./dist/es/index.js",
33
- "require": "./dist/js/index.js"
33
+ "import": {
34
+ "types": "./dist/esm/index.d.ts",
35
+ "default": "./dist/esm/index.js"
36
+ },
37
+ "require": {
38
+ "types": "./dist/cjs/index.d.cts",
39
+ "default": "./dist/cjs/index.cjs"
40
+ }
34
41
  }
35
42
  },
36
- "types": "dist/js/index.d.ts",
37
43
  "sideEffects": false,
38
44
  "files": [
39
45
  "dist"
40
46
  ],
41
47
  "scripts": {
42
- "bench": "tsx bench.js",
43
- "build": "npm-run-all build:*",
44
- "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
45
- "build:js": "tsc",
46
- "docs": "tsx ../../scripts/generate-readmes",
47
- "test": "npm-run-all test:*",
48
- "test:tape": "tsx test.js"
48
+ "bench": "tsx bench.ts",
49
+ "build": "tsup --config ../../tsup.config.ts",
50
+ "docs": "tsx ../../scripts/generate-readmes.ts",
51
+ "test": "npm-run-all --npm-path npm test:*",
52
+ "test:tape": "tsx test.ts"
49
53
  },
50
54
  "devDependencies": {
51
- "@turf/bbox-polygon": "^7.0.0-alpha.2",
52
- "@turf/truncate": "^7.0.0-alpha.2",
53
- "@types/tape": "*",
54
- "benchmark": "*",
55
- "npm-run-all": "*",
56
- "tape": "*",
57
- "tslint": "*",
58
- "tsx": "*",
59
- "typescript": "*",
60
- "write-json-file": "*"
55
+ "@turf/bbox-polygon": "^7.1.0-alpha.7+0ce6ecca0",
56
+ "@turf/truncate": "^7.1.0-alpha.7+0ce6ecca0",
57
+ "@types/benchmark": "^2.1.5",
58
+ "@types/tape": "^4.2.32",
59
+ "benchmark": "^2.1.4",
60
+ "npm-run-all": "^4.1.5",
61
+ "tape": "^5.7.2",
62
+ "tsup": "^8.0.1",
63
+ "tsx": "^4.6.2",
64
+ "typescript": "^5.2.2",
65
+ "write-json-file": "^5.0.0"
61
66
  },
62
67
  "dependencies": {
63
- "@turf/helpers": "^7.0.0-alpha.2",
64
- "@turf/rectangle-grid": "^7.0.0-alpha.2",
65
- "tslib": "^2.3.0"
68
+ "@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
69
+ "@turf/rectangle-grid": "^7.1.0-alpha.7+0ce6ecca0",
70
+ "tslib": "^2.6.2"
66
71
  },
67
- "gitHead": "dd35b52725945b4fa29a98d9a550733e06cc222e"
72
+ "gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
68
73
  }
@@ -1 +0,0 @@
1
- {"type":"module"}
package/dist/js/index.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const rectangle_grid_1 = tslib_1.__importDefault(require("@turf/rectangle-grid"));
5
- /**
6
- * Creates a square grid from a bounding box.
7
- *
8
- * @name squareGrid
9
- * @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
10
- * @param {number} cellSide of each cell, in units
11
- * @param {Object} [options={}] Optional parameters
12
- * @param {string} [options.units='kilometers'] used in calculating cellSide, can be degrees,
13
- * radians, miles, or kilometers
14
- * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,
15
- * the grid Points will be created only inside it
16
- * @param {Object} [options.properties={}] passed to each point of the grid
17
- * @returns {FeatureCollection<Polygon>} grid a grid of polygons
18
- * @example
19
- * var bbox = [-95, 30 ,-85, 40];
20
- * var cellSide = 50;
21
- * var options = {units: 'miles'};
22
- *
23
- * var squareGrid = turf.squareGrid(bbox, cellSide, options);
24
- *
25
- * //addToMap
26
- * var addToMap = [squareGrid]
27
- */
28
- function squareGrid(bbox, cellSide, options = {}) {
29
- return rectangle_grid_1.default(bbox, cellSide, cellSide, options);
30
- }
31
- exports.default = squareGrid;