@turf/length 6.4.0 → 7.0.0-alpha.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/README.md CHANGED
@@ -6,13 +6,14 @@
6
6
 
7
7
  Takes a [GeoJSON][1] and measures its length in the specified units, [(Multi)Point][2]'s distance are ignored.
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `geojson` **[Feature][3]<([LineString][4] \| [MultiLineString][5])>** GeoJSON to measure
12
- - `options` **[Object][6]** Optional parameters (optional, default `{}`)
13
- - `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
11
+ * `geojson` **[Feature][3]<([LineString][4] | [MultiLineString][5])>** GeoJSON to measure
12
+ * `options` **[Object][6]** Optional parameters (optional, default `{}`)
14
13
 
15
- **Examples**
14
+ * `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
15
+
16
+ ### Examples
16
17
 
17
18
  ```javascript
18
19
  var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
package/dist/es/index.js CHANGED
@@ -16,11 +16,10 @@ import { segmentReduce } from "@turf/meta";
16
16
  * var addToMap = [line];
17
17
  * line.properties.distance = length;
18
18
  */
19
- export default function length(geojson, options) {
20
- if (options === void 0) { options = {}; }
19
+ export default function length(geojson, options = {}) {
21
20
  // Calculate distance from 2-vertex line segments
22
- return segmentReduce(geojson, function (previousValue, segment) {
23
- var coords = segment.geometry.coordinates;
21
+ return segmentReduce(geojson, (previousValue, segment) => {
22
+ const coords = segment.geometry.coordinates;
24
23
  return previousValue + distance(coords[0], coords[1], options);
25
24
  }, 0);
26
25
  }
@@ -1,4 +1,5 @@
1
- import { Feature, FeatureCollection, GeometryCollection, Units } from "@turf/helpers";
1
+ import { Feature, FeatureCollection, GeometryCollection } from "geojson";
2
+ import { Units } from "@turf/helpers";
2
3
  /**
3
4
  * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
4
5
  *
package/dist/js/index.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var distance_1 = __importDefault(require("@turf/distance"));
7
- var meta_1 = require("@turf/meta");
3
+ const tslib_1 = require("tslib");
4
+ const distance_1 = tslib_1.__importDefault(require("@turf/distance"));
5
+ const meta_1 = require("@turf/meta");
8
6
  /**
9
7
  * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
10
8
  *
@@ -21,11 +19,10 @@ var meta_1 = require("@turf/meta");
21
19
  * var addToMap = [line];
22
20
  * line.properties.distance = length;
23
21
  */
24
- function length(geojson, options) {
25
- if (options === void 0) { options = {}; }
22
+ function length(geojson, options = {}) {
26
23
  // Calculate distance from 2-vertex line segments
27
- return meta_1.segmentReduce(geojson, function (previousValue, segment) {
28
- var coords = segment.geometry.coordinates;
24
+ return meta_1.segmentReduce(geojson, (previousValue, segment) => {
25
+ const coords = segment.geometry.coordinates;
29
26
  return previousValue + distance_1.default(coords[0], coords[1], options);
30
27
  }, 0);
31
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/length",
3
- "version": "6.4.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf length module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -16,6 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "git://github.com/Turfjs/turf.git"
18
18
  },
19
+ "funding": "https://opencollective.com/turf",
19
20
  "publishConfig": {
20
21
  "access": "public"
21
22
  },
@@ -62,9 +63,10 @@
62
63
  "write-json-file": "*"
63
64
  },
64
65
  "dependencies": {
65
- "@turf/distance": "^6.4.0",
66
- "@turf/helpers": "^6.4.0",
67
- "@turf/meta": "^6.4.0"
66
+ "@turf/distance": "^7.0.0-alpha.0",
67
+ "@turf/helpers": "^7.0.0-alpha.0",
68
+ "@turf/meta": "^7.0.0-alpha.0",
69
+ "tslib": "^2.3.0"
68
70
  },
69
- "gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
71
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
70
72
  }