@turf/midpoint 7.1.0-alpha.7 → 7.1.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
@@ -4,36 +4,35 @@
4
4
 
5
5
  ## midpoint
6
6
 
7
- Takes two [points][1] and returns a point midway between them.
8
- The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.
7
+ Takes two points and returns a point midway between them. The midpoint is
8
+ calculated geodesically, meaning the curvature of the earth is taken into
9
+ account.
9
10
 
10
11
  ### Parameters
11
12
 
12
- * `point1` **[Coord][2]** first point
13
- * `point2` **[Coord][2]** second point
13
+ * `point1` **[Coord][1]** first point
14
+ * `point2` **[Coord][1]** second point
14
15
 
15
16
  ### Examples
16
17
 
17
18
  ```javascript
18
- var point1 = turf.point([144.834823, -37.771257]);
19
- var point2 = turf.point([145.14244, -37.830937]);
19
+ const point1 = turf.point([144.834823, -37.771257]);
20
+ const point2 = turf.point([145.14244, -37.830937]);
20
21
 
21
- var midpoint = turf.midpoint(point1, point2);
22
+ const midpoint = turf.midpoint(point1, point2);
22
23
 
23
24
  //addToMap
24
- var addToMap = [point1, point2, midpoint];
25
+ const addToMap = [point1, point2, midpoint];
25
26
  midpoint.properties['marker-color'] = '#f00';
26
27
  ```
27
28
 
28
- Returns **[Feature][3]<[Point][4]>** a point midway between `pt1` and `pt2`
29
+ Returns **[Feature][2]<[Point][3]>** a point midway between `pt1` and `pt2`
29
30
 
30
- [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
31
+ [1]: https://tools.ietf.org/html/rfc7946#section-3.1.1
31
32
 
32
- [2]: https://tools.ietf.org/html/rfc7946#section-3.1.1
33
+ [2]: https://tools.ietf.org/html/rfc7946#section-3.2
33
34
 
34
- [3]: https://tools.ietf.org/html/rfc7946#section-3.2
35
-
36
- [4]: https://tools.ietf.org/html/rfc7946#section-3.1.2
35
+ [3]: https://tools.ietf.org/html/rfc7946#section-3.1.2
37
36
 
38
37
  <!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
39
38
 
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
2
2
  var _bearing = require('@turf/bearing');
3
3
  var _destination = require('@turf/destination');
4
4
  var _distance = require('@turf/distance');
5
5
  function midpoint(point1, point2) {
6
- var dist = _distance.distance.call(void 0, point1, point2);
7
- var heading = _bearing.bearing.call(void 0, point1, point2);
8
- var midpoint2 = _destination.destination.call(void 0, point1, dist / 2, heading);
6
+ const dist = _distance.distance.call(void 0, point1, point2);
7
+ const heading = _bearing.bearing.call(void 0, point1, point2);
8
+ const midpoint2 = _destination.destination.call(void 0, point1, dist / 2, heading);
9
9
  return midpoint2;
10
10
  }
11
11
  var turf_midpoint_default = midpoint;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.js"],"names":["midpoint"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAoBzB,SAAS,SAAS,QAAQ,QAAQ;AAChC,MAAI,OAAO,SAAS,QAAQ,MAAM;AAClC,MAAI,UAAU,QAAQ,QAAQ,MAAM;AACpC,MAAIA,YAAW,YAAY,QAAQ,OAAO,GAAG,OAAO;AAEpD,SAAOA;AACT;AAGA,IAAO,wBAAQ","sourcesContent":["import { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance } from \"@turf/distance\";\n\n/**\n * Takes two {@link Point|points} and returns a point midway between them.\n * The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.\n *\n * @name midpoint\n * @param {Coord} point1 first point\n * @param {Coord} point2 second point\n * @returns {Feature<Point>} a point midway between `pt1` and `pt2`\n * @example\n * var point1 = turf.point([144.834823, -37.771257]);\n * var point2 = turf.point([145.14244, -37.830937]);\n *\n * var midpoint = turf.midpoint(point1, point2);\n *\n * //addToMap\n * var addToMap = [point1, point2, midpoint];\n * midpoint.properties['marker-color'] = '#f00';\n */\nfunction midpoint(point1, point2) {\n var dist = distance(point1, point2);\n var heading = bearing(point1, point2);\n var midpoint = destination(point1, dist / 2, heading);\n\n return midpoint;\n}\n\nexport { midpoint };\nexport default midpoint;\n"]}
1
+ {"version":3,"sources":["../../index.ts"],"names":["midpoint"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAsBzB,SAAS,SAAS,QAAe,QAA+B;AAC9D,QAAM,OAAO,SAAS,QAAQ,MAAM;AACpC,QAAM,UAAU,QAAQ,QAAQ,MAAM;AACtC,QAAMA,YAAW,YAAY,QAAQ,OAAO,GAAG,OAAO;AAEtD,SAAOA;AACT;AAGA,IAAO,wBAAQ","sourcesContent":["import { Feature, Point } from \"geojson\";\nimport { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance } from \"@turf/distance\";\nimport { Coord } from \"@turf/helpers\";\n\n/**\n * Takes two points and returns a point midway between them. The midpoint is\n * calculated geodesically, meaning the curvature of the earth is taken into\n * account.\n *\n * @name midpoint\n * @param {Coord} point1 first point\n * @param {Coord} point2 second point\n * @returns {Feature<Point>} a point midway between `pt1` and `pt2`\n * @example\n * const point1 = turf.point([144.834823, -37.771257]);\n * const point2 = turf.point([145.14244, -37.830937]);\n *\n * const midpoint = turf.midpoint(point1, point2);\n *\n * //addToMap\n * const addToMap = [point1, point2, midpoint];\n * midpoint.properties['marker-color'] = '#f00';\n */\nfunction midpoint(point1: Coord, point2: Coord): Feature<Point> {\n const dist = distance(point1, point2);\n const heading = bearing(point1, point2);\n const midpoint = destination(point1, dist / 2, heading);\n\n return midpoint;\n}\n\nexport { midpoint };\nexport default midpoint;\n"]}
@@ -2,7 +2,23 @@ import { Feature, Point } from 'geojson';
2
2
  import { Coord } from '@turf/helpers';
3
3
 
4
4
  /**
5
- * http://turfjs.org/docs/#midpoint
5
+ * Takes two points and returns a point midway between them. The midpoint is
6
+ * calculated geodesically, meaning the curvature of the earth is taken into
7
+ * account.
8
+ *
9
+ * @name midpoint
10
+ * @param {Coord} point1 first point
11
+ * @param {Coord} point2 second point
12
+ * @returns {Feature<Point>} a point midway between `pt1` and `pt2`
13
+ * @example
14
+ * const point1 = turf.point([144.834823, -37.771257]);
15
+ * const point2 = turf.point([145.14244, -37.830937]);
16
+ *
17
+ * const midpoint = turf.midpoint(point1, point2);
18
+ *
19
+ * //addToMap
20
+ * const addToMap = [point1, point2, midpoint];
21
+ * midpoint.properties['marker-color'] = '#f00';
6
22
  */
7
23
  declare function midpoint(point1: Coord, point2: Coord): Feature<Point>;
8
24
 
@@ -2,7 +2,23 @@ import { Feature, Point } from 'geojson';
2
2
  import { Coord } from '@turf/helpers';
3
3
 
4
4
  /**
5
- * http://turfjs.org/docs/#midpoint
5
+ * Takes two points and returns a point midway between them. The midpoint is
6
+ * calculated geodesically, meaning the curvature of the earth is taken into
7
+ * account.
8
+ *
9
+ * @name midpoint
10
+ * @param {Coord} point1 first point
11
+ * @param {Coord} point2 second point
12
+ * @returns {Feature<Point>} a point midway between `pt1` and `pt2`
13
+ * @example
14
+ * const point1 = turf.point([144.834823, -37.771257]);
15
+ * const point2 = turf.point([145.14244, -37.830937]);
16
+ *
17
+ * const midpoint = turf.midpoint(point1, point2);
18
+ *
19
+ * //addToMap
20
+ * const addToMap = [point1, point2, midpoint];
21
+ * midpoint.properties['marker-color'] = '#f00';
6
22
  */
7
23
  declare function midpoint(point1: Coord, point2: Coord): Feature<Point>;
8
24
 
package/dist/esm/index.js CHANGED
@@ -1,11 +1,11 @@
1
- // index.js
1
+ // index.ts
2
2
  import { bearing } from "@turf/bearing";
3
3
  import { destination } from "@turf/destination";
4
4
  import { distance } from "@turf/distance";
5
5
  function midpoint(point1, point2) {
6
- var dist = distance(point1, point2);
7
- var heading = bearing(point1, point2);
8
- var midpoint2 = destination(point1, dist / 2, heading);
6
+ const dist = distance(point1, point2);
7
+ const heading = bearing(point1, point2);
8
+ const midpoint2 = destination(point1, dist / 2, heading);
9
9
  return midpoint2;
10
10
  }
11
11
  var turf_midpoint_default = midpoint;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.js"],"sourcesContent":["import { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance } from \"@turf/distance\";\n\n/**\n * Takes two {@link Point|points} and returns a point midway between them.\n * The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.\n *\n * @name midpoint\n * @param {Coord} point1 first point\n * @param {Coord} point2 second point\n * @returns {Feature<Point>} a point midway between `pt1` and `pt2`\n * @example\n * var point1 = turf.point([144.834823, -37.771257]);\n * var point2 = turf.point([145.14244, -37.830937]);\n *\n * var midpoint = turf.midpoint(point1, point2);\n *\n * //addToMap\n * var addToMap = [point1, point2, midpoint];\n * midpoint.properties['marker-color'] = '#f00';\n */\nfunction midpoint(point1, point2) {\n var dist = distance(point1, point2);\n var heading = bearing(point1, point2);\n var midpoint = destination(point1, dist / 2, heading);\n\n return midpoint;\n}\n\nexport { midpoint };\nexport default midpoint;\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAoBzB,SAAS,SAAS,QAAQ,QAAQ;AAChC,MAAI,OAAO,SAAS,QAAQ,MAAM;AAClC,MAAI,UAAU,QAAQ,QAAQ,MAAM;AACpC,MAAIA,YAAW,YAAY,QAAQ,OAAO,GAAG,OAAO;AAEpD,SAAOA;AACT;AAGA,IAAO,wBAAQ;","names":["midpoint"]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, Point } from \"geojson\";\nimport { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance } from \"@turf/distance\";\nimport { Coord } from \"@turf/helpers\";\n\n/**\n * Takes two points and returns a point midway between them. The midpoint is\n * calculated geodesically, meaning the curvature of the earth is taken into\n * account.\n *\n * @name midpoint\n * @param {Coord} point1 first point\n * @param {Coord} point2 second point\n * @returns {Feature<Point>} a point midway between `pt1` and `pt2`\n * @example\n * const point1 = turf.point([144.834823, -37.771257]);\n * const point2 = turf.point([145.14244, -37.830937]);\n *\n * const midpoint = turf.midpoint(point1, point2);\n *\n * //addToMap\n * const addToMap = [point1, point2, midpoint];\n * midpoint.properties['marker-color'] = '#f00';\n */\nfunction midpoint(point1: Coord, point2: Coord): Feature<Point> {\n const dist = distance(point1, point2);\n const heading = bearing(point1, point2);\n const midpoint = destination(point1, dist / 2, heading);\n\n return midpoint;\n}\n\nexport { midpoint };\nexport default midpoint;\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAsBzB,SAAS,SAAS,QAAe,QAA+B;AAC9D,QAAM,OAAO,SAAS,QAAQ,MAAM;AACpC,QAAM,UAAU,QAAQ,QAAQ,MAAM;AACtC,QAAMA,YAAW,YAAY,QAAQ,OAAO,GAAG,OAAO;AAEtD,SAAOA;AACT;AAGA,IAAO,wBAAQ;","names":["midpoint"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/midpoint",
3
- "version": "7.1.0-alpha.7+0ce6ecca0",
3
+ "version": "7.1.0",
4
4
  "description": "turf midpoint module",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
@@ -53,17 +53,21 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/benchmark": "^2.1.5",
56
+ "@types/tape": "^4.2.32",
56
57
  "benchmark": "^2.1.4",
57
58
  "npm-run-all": "^4.1.5",
58
59
  "tape": "^5.7.2",
59
60
  "tsup": "^8.0.1",
60
- "tsx": "^4.6.2"
61
+ "tsx": "^4.6.2",
62
+ "typescript": "^5.2.2"
61
63
  },
62
64
  "dependencies": {
63
- "@turf/bearing": "^7.1.0-alpha.7+0ce6ecca0",
64
- "@turf/destination": "^7.1.0-alpha.7+0ce6ecca0",
65
- "@turf/distance": "^7.1.0-alpha.7+0ce6ecca0",
66
- "@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0"
65
+ "@turf/bearing": "^7.1.0",
66
+ "@turf/destination": "^7.1.0",
67
+ "@turf/distance": "^7.1.0",
68
+ "@turf/helpers": "^7.1.0",
69
+ "@types/geojson": "^7946.0.10",
70
+ "tslib": "^2.6.2"
67
71
  },
68
- "gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
72
+ "gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
69
73
  }