@turf/projection 6.5.0 → 7.0.0-alpha.1

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
  Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `geojson` **([GeoJSON][1] | Position)** WGS84 GeoJSON object
12
- - `options` **[Object][2]?** Optional parameters
13
- - `options.mutate` **[boolean][3]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
11
+ * `geojson` **([GeoJSON][1] | Position)** WGS84 GeoJSON object
12
+ * `options` **[Object][2]?** Optional parameters
14
13
 
15
- **Examples**
14
+ * `options.mutate` **[boolean][3]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
15
+
16
+ ### Examples
16
17
 
17
18
  ```javascript
18
19
  var pt = turf.point([-71,41]);
@@ -28,13 +29,14 @@ Returns **[GeoJSON][1]** Projected GeoJSON
28
29
 
29
30
  Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
30
31
 
31
- **Parameters**
32
+ ### Parameters
33
+
34
+ * `geojson` **([GeoJSON][1] | Position)** Mercator GeoJSON object
35
+ * `options` **[Object][2]?** Optional parameters
32
36
 
33
- - `geojson` **([GeoJSON][1] | Position)** Mercator GeoJSON object
34
- - `options` **[Object][2]?** Optional parameters
35
- - `options.mutate` **[boolean][3]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
37
+ * `options.mutate` **[boolean][3]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
36
38
 
37
- **Examples**
39
+ ### Examples
38
40
 
39
41
  ```javascript
40
42
  var pt = turf.point([-7903683.846322424, 5012341.663847514]);
package/dist/es/index.js CHANGED
@@ -16,8 +16,7 @@ import clone from "@turf/clone";
16
16
  * //addToMap
17
17
  * var addToMap = [pt, converted];
18
18
  */
19
- export function toMercator(geojson, options) {
20
- if (options === void 0) { options = {}; }
19
+ export function toMercator(geojson, options = {}) {
21
20
  return convert(geojson, "mercator", options);
22
21
  }
23
22
  /**
@@ -35,8 +34,7 @@ export function toMercator(geojson, options) {
35
34
  * //addToMap
36
35
  * var addToMap = [pt, converted];
37
36
  */
38
- export function toWgs84(geojson, options) {
39
- if (options === void 0) { options = {}; }
37
+ export function toWgs84(geojson, options = {}) {
40
38
  return convert(geojson, "wgs84", options);
41
39
  }
42
40
  /**
@@ -49,8 +47,7 @@ export function toWgs84(geojson, options) {
49
47
  * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
50
48
  * @returns {GeoJSON} Converted GeoJSON
51
49
  */
52
- function convert(geojson, projection, options) {
53
- if (options === void 0) { options = {}; }
50
+ function convert(geojson, projection, options = {}) {
54
51
  // Optional parameters
55
52
  options = options || {};
56
53
  var mutate = options.mutate;
@@ -1,4 +1,5 @@
1
- import { AllGeoJSON, Position } from "@turf/helpers";
1
+ import { Position } from "geojson";
2
+ import { AllGeoJSON } from "@turf/helpers";
2
3
  /**
3
4
  * Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
4
5
  *
package/dist/js/index.js CHANGED
@@ -1,11 +1,9 @@
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 meta_1 = require("@turf/meta");
7
- var helpers_1 = require("@turf/helpers");
8
- var clone_1 = __importDefault(require("@turf/clone"));
3
+ const tslib_1 = require("tslib");
4
+ const meta_1 = require("@turf/meta");
5
+ const helpers_1 = require("@turf/helpers");
6
+ const clone_1 = tslib_1.__importDefault(require("@turf/clone"));
9
7
  /**
10
8
  * Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
11
9
  *
@@ -21,8 +19,7 @@ var clone_1 = __importDefault(require("@turf/clone"));
21
19
  * //addToMap
22
20
  * var addToMap = [pt, converted];
23
21
  */
24
- function toMercator(geojson, options) {
25
- if (options === void 0) { options = {}; }
22
+ function toMercator(geojson, options = {}) {
26
23
  return convert(geojson, "mercator", options);
27
24
  }
28
25
  exports.toMercator = toMercator;
@@ -41,8 +38,7 @@ exports.toMercator = toMercator;
41
38
  * //addToMap
42
39
  * var addToMap = [pt, converted];
43
40
  */
44
- function toWgs84(geojson, options) {
45
- if (options === void 0) { options = {}; }
41
+ function toWgs84(geojson, options = {}) {
46
42
  return convert(geojson, "wgs84", options);
47
43
  }
48
44
  exports.toWgs84 = toWgs84;
@@ -56,8 +52,7 @@ exports.toWgs84 = toWgs84;
56
52
  * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
57
53
  * @returns {GeoJSON} Converted GeoJSON
58
54
  */
59
- function convert(geojson, projection, options) {
60
- if (options === void 0) { options = {}; }
55
+ function convert(geojson, projection, options = {}) {
61
56
  // Optional parameters
62
57
  options = options || {};
63
58
  var mutate = options.mutate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/projection",
3
- "version": "6.5.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "turf projection module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -39,6 +39,7 @@
39
39
  "exports": {
40
40
  "./package.json": "./package.json",
41
41
  ".": {
42
+ "types": "./dist/js/index.d.ts",
42
43
  "import": "./dist/es/index.js",
43
44
  "require": "./dist/js/index.js"
44
45
  }
@@ -49,32 +50,33 @@
49
50
  "dist"
50
51
  ],
51
52
  "scripts": {
52
- "bench": "ts-node bench.js",
53
+ "bench": "tsx bench.js",
53
54
  "build": "npm-run-all build:*",
54
55
  "build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
55
56
  "build:js": "tsc",
56
- "docs": "node ../../scripts/generate-readmes",
57
+ "docs": "tsx ../../scripts/generate-readmes",
57
58
  "test": "npm-run-all test:*",
58
- "test:tape": "ts-node -r esm test.js",
59
- "test:types": "tsc --esModuleInterop --noEmit types.ts"
59
+ "test:tape": "tsx test.js",
60
+ "test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
60
61
  },
61
62
  "devDependencies": {
62
- "@turf/truncate": "^6.5.0",
63
+ "@turf/truncate": "^7.0.0-alpha.1",
63
64
  "@types/tape": "*",
64
65
  "benchmark": "*",
65
66
  "load-json-file": "*",
66
67
  "npm-run-all": "*",
67
68
  "proj4": "*",
68
69
  "tape": "*",
69
- "ts-node": "*",
70
70
  "tslint": "*",
71
+ "tsx": "*",
71
72
  "typescript": "*",
72
73
  "write-json-file": "*"
73
74
  },
74
75
  "dependencies": {
75
- "@turf/clone": "^6.5.0",
76
- "@turf/helpers": "^6.5.0",
77
- "@turf/meta": "^6.5.0"
76
+ "@turf/clone": "^7.0.0-alpha.1",
77
+ "@turf/helpers": "^7.0.0-alpha.1",
78
+ "@turf/meta": "^7.0.0-alpha.1",
79
+ "tslib": "^2.3.0"
78
80
  },
79
- "gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
81
+ "gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
80
82
  }