@turf/bbox-polygon 7.1.0 → 7.3.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
@@ -11,8 +11,8 @@ Takes a bbox and returns an equivalent [polygon][1].
11
11
  * `bbox` **[BBox][2]** extent in \[minX, minY, maxX, maxY] order
12
12
  * `options` **[Object][3]** Optional parameters (optional, default `{}`)
13
13
 
14
- * `options.properties` **Properties** Translate properties to Polygon (optional, default `{}`)
15
- * `options.id` **([string][4] | [number][5])** Translate Id to Polygon (optional, default `{}`)
14
+ * `options.properties` **[GeoJsonProperties][4]** Translate properties to Polygon (optional, default `{}`)
15
+ * `options.id` **([string][5] | [number][6])** Translate Id to Polygon (optional, default `{}`)
16
16
 
17
17
  ### Examples
18
18
 
@@ -25,7 +25,7 @@ var poly = turf.bboxPolygon(bbox);
25
25
  var addToMap = [poly]
26
26
  ```
27
27
 
28
- Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding box
28
+ Returns **[Feature][4]<[Polygon][1]>** a Polygon representation of the bounding box
29
29
 
30
30
  [1]: https://tools.ietf.org/html/rfc7946#section-3.1.6
31
31
 
@@ -33,11 +33,11 @@ Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding
33
33
 
34
34
  [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
35
35
 
36
- [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
36
+ [4]: https://tools.ietf.org/html/rfc7946#section-3.2
37
37
 
38
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
38
+ [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
39
39
 
40
- [6]: https://tools.ietf.org/html/rfc7946#section-3.2
40
+ [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
41
41
 
42
42
  <!-- 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. -->
43
43
 
@@ -20,9 +20,9 @@ function bboxPolygon(bbox, options = {}) {
20
20
  { bbox, id: options.id }
21
21
  );
22
22
  }
23
- var turf_bbox_polygon_default = bboxPolygon;
23
+ var index_default = bboxPolygon;
24
24
 
25
25
 
26
26
 
27
- exports.bboxPolygon = bboxPolygon; exports.default = turf_bbox_polygon_default;
27
+ exports.bboxPolygon = bboxPolygon; exports.default = index_default;
28
28
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,eAAmB;AAmB5B,SAAS,YACP,MACA,UAGI,CAAC,GACgB;AAIrB,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAE5B,MAAI,KAAK,WAAW,GAAG;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,WAAW,CAAC,MAAM,KAAK;AAC7B,QAAM,WAAW,CAAC,MAAM,KAAK;AAE7B,SAAO;AAAA,IACL,CAAC,CAAC,SAAS,UAAU,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,QAAQ;AAAA,IACR,EAAE,MAAM,IAAI,QAAQ,GAAG;AAAA,EACzB;AACF;AAGA,IAAO,4BAAQ","sourcesContent":["import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @name bboxPolygon\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {Properties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-bbox-polygon/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA4B;AAmB5B,SAAS,WAAA,CACP,IAAA,EACA,QAAA,EAGI,CAAC,CAAA,EACgB;AAIrB,EAAA,MAAM,KAAA,EAAO,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC3B,EAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC5B,EAAA,MAAM,KAAA,EAAO,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAC3B,EAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,CAAC,CAAC,CAAA;AAE5B,EAAA,GAAA,CAAI,IAAA,CAAK,OAAA,IAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IACF,CAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAC5B,EAAA,MAAM,QAAA,EAAU,CAAC,IAAA,EAAM,KAAK,CAAA;AAC5B,EAAA,MAAM,SAAA,EAAW,CAAC,IAAA,EAAM,KAAK,CAAA;AAC7B,EAAA,MAAM,SAAA,EAAW,CAAC,IAAA,EAAM,KAAK,CAAA;AAE7B,EAAA,OAAO,8BAAA;AAAA,IACL,CAAC,CAAC,OAAA,EAAS,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC,CAAA;AAAA,IAChD,OAAA,CAAQ,UAAA;AAAA,IACR,EAAE,IAAA,EAAM,EAAA,EAAI,OAAA,CAAQ,GAAG;AAAA,EACzB,CAAA;AACF;AAGA,IAAO,cAAA,EAAQ,WAAA;AD/Bf;AACE;AACA;AACF,mEAAC","file":"/home/runner/work/turf/turf/packages/turf-bbox-polygon/dist/cjs/index.cjs","sourcesContent":[null,"import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @function\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"]}
@@ -4,10 +4,10 @@ import { Id } from '@turf/helpers';
4
4
  /**
5
5
  * Takes a bbox and returns an equivalent {@link Polygon|polygon}.
6
6
  *
7
- * @name bboxPolygon
7
+ * @function
8
8
  * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
9
9
  * @param {Object} [options={}] Optional parameters
10
- * @param {Properties} [options.properties={}] Translate properties to Polygon
10
+ * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon
11
11
  * @param {string|number} [options.id={}] Translate Id to Polygon
12
12
  * @returns {Feature<Polygon>} a Polygon representation of the bounding box
13
13
  * @example
@@ -4,10 +4,10 @@ import { Id } from '@turf/helpers';
4
4
  /**
5
5
  * Takes a bbox and returns an equivalent {@link Polygon|polygon}.
6
6
  *
7
- * @name bboxPolygon
7
+ * @function
8
8
  * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
9
9
  * @param {Object} [options={}] Optional parameters
10
- * @param {Properties} [options.properties={}] Translate properties to Polygon
10
+ * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon
11
11
  * @param {string|number} [options.id={}] Translate Id to Polygon
12
12
  * @returns {Feature<Polygon>} a Polygon representation of the bounding box
13
13
  * @example
package/dist/esm/index.js CHANGED
@@ -20,9 +20,9 @@ function bboxPolygon(bbox, options = {}) {
20
20
  { bbox, id: options.id }
21
21
  );
22
22
  }
23
- var turf_bbox_polygon_default = bboxPolygon;
23
+ var index_default = bboxPolygon;
24
24
  export {
25
25
  bboxPolygon,
26
- turf_bbox_polygon_default as default
26
+ index_default as default
27
27
  };
28
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @name bboxPolygon\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {Properties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"],"mappings":";AACA,SAAS,eAAmB;AAmB5B,SAAS,YACP,MACA,UAGI,CAAC,GACgB;AAIrB,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAE5B,MAAI,KAAK,WAAW,GAAG;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,WAAW,CAAC,MAAM,KAAK;AAC7B,QAAM,WAAW,CAAC,MAAM,KAAK;AAE7B,SAAO;AAAA,IACL,CAAC,CAAC,SAAS,UAAU,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,QAAQ;AAAA,IACR,EAAE,MAAM,IAAI,QAAQ,GAAG;AAAA,EACzB;AACF;AAGA,IAAO,4BAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, Feature, Polygon, GeoJsonProperties } from \"geojson\";\nimport { polygon, Id } from \"@turf/helpers\";\n\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @function\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nfunction bboxPolygon<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n options: {\n properties?: P;\n id?: Id;\n } = {}\n): Feature<Polygon, P> {\n // Convert BBox positions to Numbers\n // No performance loss for including Number()\n // https://github.com/Turfjs/turf/issues/1119\n const west = Number(bbox[0]);\n const south = Number(bbox[1]);\n const east = Number(bbox[2]);\n const north = Number(bbox[3]);\n\n if (bbox.length === 6) {\n throw new Error(\n \"@turf/bbox-polygon does not support BBox with 6 positions\"\n );\n }\n\n const lowLeft = [west, south];\n const topLeft = [west, north];\n const topRight = [east, north];\n const lowRight = [east, south];\n\n return polygon(\n [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n options.properties,\n { bbox, id: options.id }\n );\n}\n\nexport { bboxPolygon };\nexport default bboxPolygon;\n"],"mappings":";AACA,SAAS,eAAmB;AAmB5B,SAAS,YACP,MACA,UAGI,CAAC,GACgB;AAIrB,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,KAAK,CAAC,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC,CAAC;AAE5B,MAAI,KAAK,WAAW,GAAG;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,UAAU,CAAC,MAAM,KAAK;AAC5B,QAAM,WAAW,CAAC,MAAM,KAAK;AAC7B,QAAM,WAAW,CAAC,MAAM,KAAK;AAE7B,SAAO;AAAA,IACL,CAAC,CAAC,SAAS,UAAU,UAAU,SAAS,OAAO,CAAC;AAAA,IAChD,QAAQ;AAAA,IACR,EAAE,MAAM,IAAI,QAAQ,GAAG;AAAA,EACzB;AACF;AAGA,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/bbox-polygon",
3
- "version": "7.1.0",
4
- "description": "turf bbox-polygon module",
3
+ "version": "7.3.0",
4
+ "description": "Converts a bounding box to a GeoJSON polygon.",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
7
7
  "bugs": {
@@ -53,18 +53,18 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/benchmark": "^2.1.5",
56
- "@types/tape": "^4.2.32",
56
+ "@types/tape": "^5.8.1",
57
57
  "benchmark": "^2.1.4",
58
58
  "npm-run-all": "^4.1.5",
59
- "tape": "^5.7.2",
60
- "tsup": "^8.0.1",
61
- "tsx": "^4.6.2",
62
- "typescript": "^5.2.2"
59
+ "tape": "^5.9.0",
60
+ "tsup": "^8.4.0",
61
+ "tsx": "^4.19.4",
62
+ "typescript": "^5.8.3"
63
63
  },
64
64
  "dependencies": {
65
- "@turf/helpers": "^7.1.0",
65
+ "@turf/helpers": "7.3.0",
66
66
  "@types/geojson": "^7946.0.10",
67
- "tslib": "^2.6.2"
67
+ "tslib": "^2.8.1"
68
68
  },
69
- "gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
69
+ "gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
70
70
  }