@turf/centroid 7.0.0 → 7.1.0-alpha.70

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
@@ -24,7 +24,7 @@ var centroid = turf.centroid(polygon);
24
24
  var addToMap = [polygon, centroid]
25
25
  ```
26
26
 
27
- Returns **[Feature][4]<[Point][5]>** the centroid of the input object
27
+ Returns **[Feature][3]<[Point][4]>** the centroid of the input object
28
28
 
29
29
  [1]: https://tools.ietf.org/html/rfc7946#section-3
30
30
 
@@ -32,9 +32,7 @@ Returns **[Feature][4]<[Point][5]>** the centroid of the input object
32
32
 
33
33
  [3]: https://tools.ietf.org/html/rfc7946#section-3.2
34
34
 
35
- [4]: https://tools.ietf.org/html/rfc7946#section-3.2
36
-
37
- [5]: https://tools.ietf.org/html/rfc7946#section-3.1.2
35
+ [4]: https://tools.ietf.org/html/rfc7946#section-3.1.2
38
36
 
39
37
  <!-- 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. -->
40
38
 
@@ -1,7 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- // index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
5
2
  var _helpers = require('@turf/helpers');
6
3
  var _meta = require('@turf/meta');
7
4
  function centroid(geojson, options = {}) {
@@ -19,7 +16,6 @@ function centroid(geojson, options = {}) {
19
16
  );
20
17
  return _helpers.point.call(void 0, [xSum / len, ySum / len], options.properties);
21
18
  }
22
- __name(centroid, "centroid");
23
19
  var turf_centroid_default = centroid;
24
20
 
25
21
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";;;;AACA,SAAS,aAAyB;AAClC,SAAS,iBAAiB;AAkB1B,SAAS,SACP,SACA,UAEI,CAAC,GACc;AACnB,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,MAAM;AACV;AAAA,IACE;AAAA,IACA,SAAU,OAAO;AACf,cAAQ,MAAM,CAAC;AACf,cAAQ,MAAM,CAAC;AACf;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACA,SAAO,MAAM,CAAC,OAAO,KAAK,OAAO,GAAG,GAAG,QAAQ,UAAU;AAC3D;AAnBS;AAsBT,IAAO,wBAAQ","sourcesContent":["import { Feature, GeoJsonProperties, Point } from \"geojson\";\nimport { point, AllGeoJSON } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\n\n/**\n * Computes the centroid as the mean of all vertices within the object.\n *\n * @name centroid\n * @param {GeoJSON} geojson GeoJSON to be centered\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties\n * @returns {Feature<Point>} the centroid of the input object\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var centroid = turf.centroid(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, centroid]\n */\nfunction centroid<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n properties?: P;\n } = {}\n): Feature<Point, P> {\n let xSum = 0;\n let ySum = 0;\n let len = 0;\n coordEach(\n geojson,\n function (coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n },\n true\n );\n return point([xSum / len, ySum / len], options.properties);\n}\n\nexport { centroid };\nexport default centroid;\n"]}
1
+ {"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,aAAyB;AAClC,SAAS,iBAAiB;AAkB1B,SAAS,SACP,SACA,UAEI,CAAC,GACc;AACnB,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,MAAM;AACV;AAAA,IACE;AAAA,IACA,SAAU,OAAO;AACf,cAAQ,MAAM,CAAC;AACf,cAAQ,MAAM,CAAC;AACf;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACA,SAAO,MAAM,CAAC,OAAO,KAAK,OAAO,GAAG,GAAG,QAAQ,UAAU;AAC3D;AAGA,IAAO,wBAAQ","sourcesContent":["import { Feature, GeoJsonProperties, Point } from \"geojson\";\nimport { point, AllGeoJSON } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\n\n/**\n * Computes the centroid as the mean of all vertices within the object.\n *\n * @name centroid\n * @param {GeoJSON} geojson GeoJSON to be centered\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties\n * @returns {Feature<Point>} the centroid of the input object\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var centroid = turf.centroid(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, centroid]\n */\nfunction centroid<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n properties?: P;\n } = {}\n): Feature<Point, P> {\n let xSum = 0;\n let ySum = 0;\n let len = 0;\n coordEach(\n geojson,\n function (coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n },\n true\n );\n return point([xSum / len, ySum / len], options.properties);\n}\n\nexport { centroid };\nexport default centroid;\n"]}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // index.ts
5
2
  import { point } from "@turf/helpers";
6
3
  import { coordEach } from "@turf/meta";
@@ -19,7 +16,6 @@ function centroid(geojson, options = {}) {
19
16
  );
20
17
  return point([xSum / len, ySum / len], options.properties);
21
18
  }
22
- __name(centroid, "centroid");
23
19
  var turf_centroid_default = centroid;
24
20
  export {
25
21
  centroid,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties, Point } from \"geojson\";\nimport { point, AllGeoJSON } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\n\n/**\n * Computes the centroid as the mean of all vertices within the object.\n *\n * @name centroid\n * @param {GeoJSON} geojson GeoJSON to be centered\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties\n * @returns {Feature<Point>} the centroid of the input object\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var centroid = turf.centroid(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, centroid]\n */\nfunction centroid<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n properties?: P;\n } = {}\n): Feature<Point, P> {\n let xSum = 0;\n let ySum = 0;\n let len = 0;\n coordEach(\n geojson,\n function (coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n },\n true\n );\n return point([xSum / len, ySum / len], options.properties);\n}\n\nexport { centroid };\nexport default centroid;\n"],"mappings":";;;;AACA,SAAS,aAAyB;AAClC,SAAS,iBAAiB;AAkB1B,SAAS,SACP,SACA,UAEI,CAAC,GACc;AACnB,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,MAAM;AACV;AAAA,IACE;AAAA,IACA,SAAU,OAAO;AACf,cAAQ,MAAM,CAAC;AACf,cAAQ,MAAM,CAAC;AACf;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACA,SAAO,MAAM,CAAC,OAAO,KAAK,OAAO,GAAG,GAAG,QAAQ,UAAU;AAC3D;AAnBS;AAsBT,IAAO,wBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, GeoJsonProperties, Point } from \"geojson\";\nimport { point, AllGeoJSON } from \"@turf/helpers\";\nimport { coordEach } from \"@turf/meta\";\n\n/**\n * Computes the centroid as the mean of all vertices within the object.\n *\n * @name centroid\n * @param {GeoJSON} geojson GeoJSON to be centered\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties\n * @returns {Feature<Point>} the centroid of the input object\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var centroid = turf.centroid(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, centroid]\n */\nfunction centroid<P extends GeoJsonProperties = GeoJsonProperties>(\n geojson: AllGeoJSON,\n options: {\n properties?: P;\n } = {}\n): Feature<Point, P> {\n let xSum = 0;\n let ySum = 0;\n let len = 0;\n coordEach(\n geojson,\n function (coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n },\n true\n );\n return point([xSum / len, ySum / len], options.properties);\n}\n\nexport { centroid };\nexport default centroid;\n"],"mappings":";AACA,SAAS,aAAyB;AAClC,SAAS,iBAAiB;AAkB1B,SAAS,SACP,SACA,UAEI,CAAC,GACc;AACnB,MAAI,OAAO;AACX,MAAI,OAAO;AACX,MAAI,MAAM;AACV;AAAA,IACE;AAAA,IACA,SAAU,OAAO;AACf,cAAQ,MAAM,CAAC;AACf,cAAQ,MAAM,CAAC;AACf;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACA,SAAO,MAAM,CAAC,OAAO,KAAK,OAAO,GAAG,GAAG,QAAQ,UAAU;AAC3D;AAGA,IAAO,wBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/centroid",
3
- "version": "7.0.0",
3
+ "version": "7.1.0-alpha.70+948cdafaf",
4
4
  "description": "turf centroid module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -65,9 +65,10 @@
65
65
  "write-json-file": "^5.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@turf/helpers": "^7.0.0",
69
- "@turf/meta": "^7.0.0",
68
+ "@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
69
+ "@turf/meta": "^7.1.0-alpha.70+948cdafaf",
70
+ "@types/geojson": "^7946.0.10",
70
71
  "tslib": "^2.6.2"
71
72
  },
72
- "gitHead": "3d3a7917025fbabe191dbddbc89754b86f9c7739"
73
+ "gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
73
74
  }