@turf/truncate 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 +8 -7
- package/dist/es/index.js +1 -2
- package/dist/js/index.d.ts +0 -0
- package/dist/js/index.js +2 -3
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -6,15 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Parameters
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- `options.precision` **[number][3]** coordinate decimal precision (optional, default `6`)
|
|
14
|
-
- `options.coordinates` **[number][3]** maximum number of coordinates (primarly used to remove z coordinates) (optional, default `3`)
|
|
15
|
-
- `options.mutate` **[boolean][4]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
11
|
+
* `geojson` **[GeoJSON][1]** any GeoJSON Feature, FeatureCollection, Geometry or GeometryCollection.
|
|
12
|
+
* `options` **[Object][2]** Optional parameters (optional, default `{}`)
|
|
16
13
|
|
|
17
|
-
**
|
|
14
|
+
* `options.precision` **[number][3]** coordinate decimal precision (optional, default `6`)
|
|
15
|
+
* `options.coordinates` **[number][3]** maximum number of coordinates (primarly used to remove z coordinates) (optional, default `3`)
|
|
16
|
+
* `options.mutate` **[boolean][4]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
18
19
|
|
|
19
20
|
```javascript
|
|
20
21
|
var point = turf.point([
|
package/dist/es/index.js
CHANGED
|
@@ -22,8 +22,7 @@ import { coordEach } from "@turf/meta";
|
|
|
22
22
|
* //addToMap
|
|
23
23
|
* var addToMap = [truncated];
|
|
24
24
|
*/
|
|
25
|
-
function truncate(geojson, options) {
|
|
26
|
-
if (options === void 0) { options = {}; }
|
|
25
|
+
function truncate(geojson, options = {}) {
|
|
27
26
|
// Optional parameters
|
|
28
27
|
var precision = options.precision;
|
|
29
28
|
var coordinates = options.coordinates;
|
package/dist/js/index.d.ts
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const meta_1 = require("@turf/meta");
|
|
4
4
|
/**
|
|
5
5
|
* Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.
|
|
6
6
|
*
|
|
@@ -24,8 +24,7 @@ var meta_1 = require("@turf/meta");
|
|
|
24
24
|
* //addToMap
|
|
25
25
|
* var addToMap = [truncated];
|
|
26
26
|
*/
|
|
27
|
-
function truncate(geojson, options) {
|
|
28
|
-
if (options === void 0) { options = {}; }
|
|
27
|
+
function truncate(geojson, options = {}) {
|
|
29
28
|
// Optional parameters
|
|
30
29
|
var precision = options.precision;
|
|
31
30
|
var coordinates = options.coordinates;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/truncate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "turf truncate module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": "./package.json",
|
|
32
32
|
".": {
|
|
33
|
+
"types": "./dist/js/index.d.ts",
|
|
33
34
|
"import": "./dist/es/index.js",
|
|
34
35
|
"require": "./dist/js/index.js"
|
|
35
36
|
}
|
|
@@ -40,14 +41,14 @@
|
|
|
40
41
|
"dist"
|
|
41
42
|
],
|
|
42
43
|
"scripts": {
|
|
43
|
-
"bench": "
|
|
44
|
+
"bench": "tsx bench.js",
|
|
44
45
|
"build": "npm-run-all build:*",
|
|
45
46
|
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
46
47
|
"build:js": "tsc",
|
|
47
|
-
"docs": "
|
|
48
|
+
"docs": "tsx ../../scripts/generate-readmes",
|
|
48
49
|
"test": "npm-run-all test:*",
|
|
49
|
-
"test:tape": "
|
|
50
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
50
|
+
"test:tape": "tsx test.js",
|
|
51
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/tape": "*",
|
|
@@ -55,14 +56,15 @@
|
|
|
55
56
|
"load-json-file": "*",
|
|
56
57
|
"npm-run-all": "*",
|
|
57
58
|
"tape": "*",
|
|
58
|
-
"ts-node": "*",
|
|
59
59
|
"tslint": "*",
|
|
60
|
+
"tsx": "*",
|
|
60
61
|
"typescript": "*",
|
|
61
62
|
"write-json-file": "*"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@turf/helpers": "^
|
|
65
|
-
"@turf/meta": "^
|
|
65
|
+
"@turf/helpers": "^7.0.0-alpha.1",
|
|
66
|
+
"@turf/meta": "^7.0.0-alpha.1",
|
|
67
|
+
"tslib": "^2.3.0"
|
|
66
68
|
},
|
|
67
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
|
|
68
70
|
}
|