@turf/centroid 7.2.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/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -16,9 +16,9 @@ function centroid(geojson, options = {}) {
|
|
|
16
16
|
);
|
|
17
17
|
return _helpers.point.call(void 0, [xSum / len, ySum / len], options.properties);
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var index_default = centroid;
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.centroid = centroid; exports.default =
|
|
23
|
+
exports.centroid = centroid; exports.default = index_default;
|
|
24
24
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,cAAA,EAAQ,QAAA;ADvBf;AACE;AACA;AACF,6DAAC","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"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -16,9 +16,9 @@ function centroid(geojson, options = {}) {
|
|
|
16
16
|
);
|
|
17
17
|
return point([xSum / len, ySum / len], options.properties);
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var index_default = centroid;
|
|
20
20
|
export {
|
|
21
21
|
centroid,
|
|
22
|
-
|
|
22
|
+
index_default as default
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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 * @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,
|
|
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,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/centroid",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Determines the geometric center of a polygon or shape.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/benchmark": "^2.1.5",
|
|
56
|
-
"@types/tape": "^
|
|
56
|
+
"@types/tape": "^5.8.1",
|
|
57
57
|
"benchmark": "^2.1.4",
|
|
58
|
-
"glob": "^
|
|
58
|
+
"glob": "^11.0.2",
|
|
59
59
|
"load-json-file": "^7.0.1",
|
|
60
60
|
"npm-run-all": "^4.1.5",
|
|
61
61
|
"tape": "^5.9.0",
|
|
62
|
-
"tsup": "^8.
|
|
63
|
-
"tsx": "^4.19.
|
|
64
|
-
"typescript": "^5.
|
|
65
|
-
"write-json-file": "^
|
|
62
|
+
"tsup": "^8.4.0",
|
|
63
|
+
"tsx": "^4.19.4",
|
|
64
|
+
"typescript": "^5.8.3",
|
|
65
|
+
"write-json-file": "^6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@turf/helpers": "
|
|
69
|
-
"@turf/meta": "
|
|
68
|
+
"@turf/helpers": "7.3.0",
|
|
69
|
+
"@turf/meta": "7.3.0",
|
|
70
70
|
"@types/geojson": "^7946.0.10",
|
|
71
71
|
"tslib": "^2.8.1"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
74
74
|
}
|