@turf/length 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/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +6 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
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 _distance = require('@turf/distance');
|
|
6
3
|
var _meta = require('@turf/meta');
|
|
7
4
|
function length(geojson, options = {}) {
|
|
@@ -14,7 +11,6 @@ function length(geojson, options = {}) {
|
|
|
14
11
|
0
|
|
15
12
|
);
|
|
16
13
|
}
|
|
17
|
-
__name(length, "length");
|
|
18
14
|
var turf_length_default = length;
|
|
19
15
|
|
|
20
16
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"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","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 * @name length\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/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 { distance } from "@turf/distance";
|
|
6
3
|
import { segmentReduce } from "@turf/meta";
|
|
@@ -14,7 +11,6 @@ function length(geojson, options = {}) {
|
|
|
14
11
|
0
|
|
15
12
|
);
|
|
16
13
|
}
|
|
17
|
-
__name(length, "length");
|
|
18
14
|
var turf_length_default = length;
|
|
19
15
|
export {
|
|
20
16
|
turf_length_default as default,
|
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 * @name length\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":"
|
|
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 * @name length\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.0.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf length module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -69,10 +69,11 @@
|
|
|
69
69
|
"write-json-file": "^5.0.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@turf/distance": "^7.0.
|
|
73
|
-
"@turf/helpers": "^7.0.
|
|
74
|
-
"@turf/meta": "^7.0.
|
|
72
|
+
"@turf/distance": "^7.1.0-alpha.70+948cdafaf",
|
|
73
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
74
|
+
"@turf/meta": "^7.1.0-alpha.70+948cdafaf",
|
|
75
|
+
"@types/geojson": "^7946.0.10",
|
|
75
76
|
"tslib": "^2.6.2"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
78
79
|
}
|