@turf/centroid 7.1.0 → 7.2.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.
@@ -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;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"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-centroid/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,wCAAkC;AAClC,kCAA0B;AAkB1B,SAAS,QAAA,CACP,OAAA,EACA,QAAA,EAEI,CAAC,CAAA,EACc;AACnB,EAAA,IAAI,KAAA,EAAO,CAAA;AACX,EAAA,IAAI,KAAA,EAAO,CAAA;AACX,EAAA,IAAI,IAAA,EAAM,CAAA;AACV,EAAA,6BAAA;AAAA,IACE,OAAA;AAAA,IACA,QAAA,CAAU,KAAA,EAAO;AACf,MAAA,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA;AACf,MAAA,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA;AACf,MAAA,GAAA,EAAA;AAAA,IACF,CAAA;AAAA,IACA;AAAA,EACF,CAAA;AACA,EAAA,OAAO,4BAAA,CAAO,KAAA,EAAO,GAAA,EAAK,KAAA,EAAO,GAAG,CAAA,EAAG,OAAA,CAAQ,UAAU,CAAA;AAC3D;AAGA,IAAO,sBAAA,EAAQ,QAAA;ADvBf;AACE;AACA;AACF,qEAAC","file":"/home/runner/work/turf/turf/packages/turf-centroid/dist/cjs/index.cjs","sourcesContent":[null,"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 * @function\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"]}
@@ -4,7 +4,7 @@ import { AllGeoJSON } from '@turf/helpers';
4
4
  /**
5
5
  * Computes the centroid as the mean of all vertices within the object.
6
6
  *
7
- * @name centroid
7
+ * @function
8
8
  * @param {GeoJSON} geojson GeoJSON to be centered
9
9
  * @param {Object} [options={}] Optional Parameters
10
10
  * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties
@@ -4,7 +4,7 @@ import { AllGeoJSON } from '@turf/helpers';
4
4
  /**
5
5
  * Computes the centroid as the mean of all vertices within the object.
6
6
  *
7
- * @name centroid
7
+ * @function
8
8
  * @param {GeoJSON} geojson GeoJSON to be centered
9
9
  * @param {Object} [options={}] Optional Parameters
10
10
  * @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties
@@ -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;AAGA,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 * @function\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.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "turf centroid module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -53,22 +53,22 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/benchmark": "^2.1.5",
56
- "@types/tape": "^4.2.32",
56
+ "@types/tape": "^4.13.4",
57
57
  "benchmark": "^2.1.4",
58
58
  "glob": "^10.3.10",
59
59
  "load-json-file": "^7.0.1",
60
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",
61
+ "tape": "^5.9.0",
62
+ "tsup": "^8.3.5",
63
+ "tsx": "^4.19.2",
64
+ "typescript": "^5.5.4",
65
65
  "write-json-file": "^5.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@turf/helpers": "^7.1.0",
69
- "@turf/meta": "^7.1.0",
68
+ "@turf/helpers": "^7.2.0",
69
+ "@turf/meta": "^7.2.0",
70
70
  "@types/geojson": "^7946.0.10",
71
- "tslib": "^2.6.2"
71
+ "tslib": "^2.8.1"
72
72
  },
73
- "gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
73
+ "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
74
74
  }