@turf/length 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.
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-length/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,0CAAyB;AAEzB,kCAA8B;AAkB9B,SAAS,MAAA,CACP,OAAA,EACA,QAAA,EAEI,CAAC,CAAA,EACG;AAER,EAAA,OAAO,iCAAA;AAAA,IACL,OAAA;AAAA,IACA,CAAC,aAAA,EAAe,OAAA,EAAA,GAAY;AAC1B,MAAA,MAAM,OAAA,EAAS,OAAA,CAAS,QAAA,CAAS,WAAA;AACjC,MAAA,OAAO,cAAA,EAAiB,gCAAA,MAAS,CAAO,CAAC,CAAA,EAAG,MAAA,CAAO,CAAC,CAAA,EAAG,OAAO,CAAA;AAAA,IAChE,CAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;AAGA,IAAO,oBAAA,EAAQ,MAAA;ADzBf;AACE;AACA;AACF,+DAAC","file":"/home/runner/work/turf/turf/packages/turf-length/dist/cjs/index.cjs","sourcesContent":[null,"import { Feature, FeatureCollection, GeometryCollection } from \"geojson\";\nimport { distance } from \"@turf/distance\";\nimport { Units } from \"@turf/helpers\";\nimport { segmentReduce } from \"@turf/meta\";\n\n/**\n * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.\n *\n * @function\n * @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers\n * @returns {number} length of GeoJSON\n * @example\n * var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);\n * var length = turf.length(line, {units: 'miles'});\n *\n * //addToMap\n * var addToMap = [line];\n * line.properties.distance = length;\n */\nfunction length(\n geojson: Feature<any> | FeatureCollection<any> | GeometryCollection,\n options: {\n units?: Units;\n } = {}\n): number {\n // Calculate distance from 2-vertex line segments\n return segmentReduce(\n geojson,\n (previousValue, segment) => {\n const coords = segment!.geometry.coordinates;\n return previousValue! + distance(coords[0], coords[1], options);\n },\n 0\n );\n}\n\nexport { length };\nexport default length;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { Units } from '@turf/helpers';
|
|
|
4
4
|
/**
|
|
5
5
|
* Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure
|
|
9
9
|
* @param {Object} [options={}] Optional parameters
|
|
10
10
|
* @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Units } from '@turf/helpers';
|
|
|
4
4
|
/**
|
|
5
5
|
* Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @function
|
|
8
8
|
* @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure
|
|
9
9
|
* @param {Object} [options={}] Optional parameters
|
|
10
10
|
* @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, FeatureCollection, GeometryCollection } from \"geojson\";\nimport { distance } from \"@turf/distance\";\nimport { Units } from \"@turf/helpers\";\nimport { segmentReduce } from \"@turf/meta\";\n\n/**\n * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, FeatureCollection, GeometryCollection } from \"geojson\";\nimport { distance } from \"@turf/distance\";\nimport { Units } from \"@turf/helpers\";\nimport { segmentReduce } from \"@turf/meta\";\n\n/**\n * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.\n *\n * @function\n * @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers\n * @returns {number} length of GeoJSON\n * @example\n * var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);\n * var length = turf.length(line, {units: 'miles'});\n *\n * //addToMap\n * var addToMap = [line];\n * line.properties.distance = length;\n */\nfunction length(\n geojson: Feature<any> | FeatureCollection<any> | GeometryCollection,\n options: {\n units?: Units;\n } = {}\n): number {\n // Calculate distance from 2-vertex line segments\n return segmentReduce(\n geojson,\n (previousValue, segment) => {\n const coords = segment!.geometry.coordinates;\n return previousValue! + distance(coords[0], coords[1], options);\n },\n 0\n );\n}\n\nexport { length };\nexport default length;\n"],"mappings":";AACA,SAAS,gBAAgB;AAEzB,SAAS,qBAAqB;AAkB9B,SAAS,OACP,SACA,UAEI,CAAC,GACG;AAER,SAAO;AAAA,IACL;AAAA,IACA,CAAC,eAAe,YAAY;AAC1B,YAAM,SAAS,QAAS,SAAS;AACjC,aAAO,gBAAiB,SAAS,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO;AAAA,IAChE;AAAA,IACA;AAAA,EACF;AACF;AAGA,IAAO,sBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/length",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf length module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -58,22 +58,22 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/benchmark": "^2.1.5",
|
|
61
|
-
"@types/tape": "^4.
|
|
61
|
+
"@types/tape": "^4.13.4",
|
|
62
62
|
"benchmark": "^2.1.4",
|
|
63
63
|
"load-json-file": "^7.0.1",
|
|
64
64
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"tape": "^5.
|
|
66
|
-
"tsup": "^8.
|
|
67
|
-
"tsx": "^4.
|
|
68
|
-
"typescript": "^5.
|
|
65
|
+
"tape": "^5.9.0",
|
|
66
|
+
"tsup": "^8.3.5",
|
|
67
|
+
"tsx": "^4.19.2",
|
|
68
|
+
"typescript": "^5.5.4",
|
|
69
69
|
"write-json-file": "^5.0.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@turf/distance": "^7.
|
|
73
|
-
"@turf/helpers": "^7.
|
|
74
|
-
"@turf/meta": "^7.
|
|
72
|
+
"@turf/distance": "^7.2.0",
|
|
73
|
+
"@turf/helpers": "^7.2.0",
|
|
74
|
+
"@turf/meta": "^7.2.0",
|
|
75
75
|
"@types/geojson": "^7946.0.10",
|
|
76
|
-
"tslib": "^2.
|
|
76
|
+
"tslib": "^2.8.1"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
79
79
|
}
|