node-red-contrib-web-worldmap 4.9.0 → 5.0.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/CHANGELOG.md +2 -0
- package/README.md +7 -3
- package/examples/{feedback.json → Feedback.json} +1 -9
- package/examples/MouseCoordinates.json +159 -0
- package/examples/sidcEdgeIcon.json +158 -0
- package/node_modules/@turf/bezier-spline/README.md +15 -21
- package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs +165 -0
- package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -0
- package/node_modules/@turf/bezier-spline/dist/{es/index.js → cjs/index.d.cts} +9 -30
- package/node_modules/@turf/bezier-spline/dist/{js → esm}/index.d.ts +5 -3
- package/node_modules/@turf/bezier-spline/dist/esm/index.js +165 -0
- package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -0
- package/node_modules/@turf/bezier-spline/package.json +33 -25
- package/node_modules/@turf/helpers/README.md +231 -219
- package/node_modules/@turf/helpers/dist/cjs/index.cjs +308 -0
- package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -0
- package/node_modules/@turf/helpers/dist/{es/index.js → cjs/index.d.cts} +103 -303
- package/node_modules/@turf/helpers/dist/{js → esm}/index.d.ts +67 -53
- package/node_modules/@turf/helpers/dist/esm/index.js +308 -0
- package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -0
- package/node_modules/@turf/helpers/package.json +32 -22
- package/node_modules/@turf/invariant/README.md +47 -58
- package/node_modules/@turf/invariant/dist/cjs/index.cjs +127 -0
- package/node_modules/@turf/invariant/dist/cjs/index.cjs.map +1 -0
- package/node_modules/@turf/invariant/dist/cjs/index.d.cts +108 -0
- package/node_modules/@turf/invariant/dist/{js → esm}/index.d.ts +12 -9
- package/node_modules/@turf/invariant/dist/esm/index.js +127 -0
- package/node_modules/@turf/invariant/dist/esm/index.js.map +1 -0
- package/node_modules/@turf/invariant/package.json +31 -22
- package/node_modules/@types/geojson/LICENSE +21 -0
- package/node_modules/@types/geojson/README.md +15 -0
- package/node_modules/@types/geojson/index.d.ts +165 -0
- package/node_modules/@types/geojson/package.json +45 -0
- package/node_modules/body-parser/HISTORY.md +7 -0
- package/node_modules/body-parser/README.md +11 -0
- package/node_modules/body-parser/lib/types/urlencoded.js +30 -7
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/encodeurl/README.md +19 -38
- package/node_modules/encodeurl/index.js +1 -1
- package/node_modules/encodeurl/package.json +7 -7
- package/node_modules/express/History.md +27 -0
- package/node_modules/express/Readme.md +100 -6
- package/node_modules/express/lib/response.js +11 -10
- package/node_modules/express/package.json +11 -11
- package/node_modules/finalhandler/HISTORY.md +15 -0
- package/node_modules/finalhandler/README.md +2 -2
- package/node_modules/finalhandler/index.js +7 -2
- package/node_modules/finalhandler/package.json +8 -7
- package/node_modules/merge-descriptors/README.md +4 -3
- package/node_modules/merge-descriptors/index.js +3 -3
- package/node_modules/merge-descriptors/package.json +14 -7
- package/node_modules/mime-db/HISTORY.md +14 -0
- package/node_modules/mime-db/README.md +27 -24
- package/node_modules/mime-db/db.json +646 -62
- package/node_modules/mime-db/package.json +9 -13
- package/node_modules/mime-types/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/mime-types/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/mime-types/node_modules/mime-db/README.md +100 -0
- package/node_modules/mime-types/node_modules/mime-db/db.json +8519 -0
- package/node_modules/mime-types/node_modules/mime-db/index.js +12 -0
- package/node_modules/mime-types/node_modules/mime-db/package.json +60 -0
- package/node_modules/object-inspect/CHANGELOG.md +15 -0
- package/node_modules/object-inspect/index.js +4 -1
- package/node_modules/object-inspect/package.json +14 -9
- package/node_modules/object-inspect/readme.markdown +9 -11
- package/node_modules/path-to-regexp/index.js +57 -40
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/.editorconfig +3 -0
- package/node_modules/qs/.eslintrc +2 -2
- package/node_modules/qs/CHANGELOG.md +59 -5
- package/node_modules/qs/README.md +133 -49
- package/node_modules/qs/dist/qs.js +56 -2020
- package/node_modules/qs/lib/parse.js +46 -13
- package/node_modules/qs/lib/stringify.js +53 -28
- package/node_modules/qs/lib/utils.js +47 -34
- package/node_modules/qs/package.json +26 -12
- package/node_modules/qs/test/empty-keys-cases.js +267 -0
- package/node_modules/qs/test/parse.js +347 -32
- package/node_modules/qs/test/stringify.js +436 -47
- package/node_modules/send/HISTORY.md +5 -0
- package/node_modules/send/index.js +1 -2
- package/node_modules/send/node_modules/encodeurl/LICENSE +22 -0
- package/node_modules/send/node_modules/encodeurl/README.md +128 -0
- package/node_modules/send/node_modules/encodeurl/index.js +60 -0
- package/node_modules/send/node_modules/encodeurl/package.json +40 -0
- package/node_modules/send/package.json +1 -1
- package/node_modules/serve-static/HISTORY.md +16 -0
- package/node_modules/serve-static/index.js +1 -2
- package/node_modules/serve-static/package.json +3 -3
- package/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/node_modules/tslib/LICENSE.txt +12 -0
- package/node_modules/tslib/README.md +164 -0
- package/node_modules/tslib/SECURITY.md +41 -0
- package/node_modules/tslib/modules/index.d.ts +37 -0
- package/node_modules/tslib/modules/index.js +68 -0
- package/node_modules/tslib/modules/package.json +3 -0
- package/node_modules/tslib/package.json +47 -0
- package/node_modules/tslib/tslib.d.ts +453 -0
- package/node_modules/tslib/tslib.es6.html +1 -0
- package/node_modules/tslib/tslib.es6.js +379 -0
- package/node_modules/tslib/tslib.es6.mjs +378 -0
- package/node_modules/tslib/tslib.html +1 -0
- package/node_modules/tslib/tslib.js +429 -0
- package/package.json +5 -5
- package/worldmap/index.html +1 -1
- package/worldmap/leaflet/leaflet.mousecoordinate.js +3 -3
- package/worldmap/worldmap.js +123 -36
- package/worldmap.html +1 -1
- package/worldmap.js +23 -4
- package/node_modules/@turf/bezier-spline/dist/es/lib/spline.js +0 -158
- package/node_modules/@turf/bezier-spline/dist/es/package.json +0 -1
- package/node_modules/@turf/bezier-spline/dist/js/index.js +0 -65
- package/node_modules/@turf/bezier-spline/dist/js/lib/spline.d.ts +0 -62
- package/node_modules/@turf/bezier-spline/dist/js/lib/spline.js +0 -160
- package/node_modules/@turf/helpers/dist/es/lib/geojson.js +0 -7
- package/node_modules/@turf/helpers/dist/es/package.json +0 -1
- package/node_modules/@turf/helpers/dist/js/index.js +0 -724
- package/node_modules/@turf/helpers/dist/js/lib/geojson.d.ts +0 -193
- package/node_modules/@turf/helpers/dist/js/lib/geojson.js +0 -9
- package/node_modules/@turf/invariant/dist/es/index.js +0 -223
- package/node_modules/@turf/invariant/dist/es/package.json +0 -1
- package/node_modules/@turf/invariant/dist/js/index.js +0 -233
- package/node_modules/path-to-regexp/History.md +0 -36
- /package/node_modules/{encodeurl → send/node_modules/encodeurl}/HISTORY.md +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Feature,
|
|
1
|
+
import { Feature, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, FeatureCollection, Geometry } from 'geojson';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
|
|
4
5
|
*
|
|
@@ -11,7 +12,7 @@ import { Feature, FeatureCollection, Geometries, GeometryCollection, Point } fro
|
|
|
11
12
|
* var coord = turf.getCoord(pt);
|
|
12
13
|
* //= [10, 10]
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
declare function getCoord(coord: Feature<Point> | Point | number[]): number[];
|
|
15
16
|
/**
|
|
16
17
|
* Unwrap coordinates from a Feature, Geometry Object or an Array
|
|
17
18
|
*
|
|
@@ -24,7 +25,7 @@ export declare function getCoord(coord: Feature<Point> | Point | number[]): numb
|
|
|
24
25
|
* var coords = turf.getCoords(poly);
|
|
25
26
|
* //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
declare function getCoords<G extends Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>(coords: any[] | Feature<G> | G): any[];
|
|
28
29
|
/**
|
|
29
30
|
* Checks if coordinates contains a number
|
|
30
31
|
*
|
|
@@ -32,7 +33,7 @@ export declare function getCoords<G extends Geometries>(coords: any[] | Feature<
|
|
|
32
33
|
* @param {Array<any>} coordinates GeoJSON Coordinates
|
|
33
34
|
* @returns {boolean} true if Array contains a number
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
declare function containsNumber(coordinates: any[]): boolean;
|
|
36
37
|
/**
|
|
37
38
|
* Enforce expectations about types of GeoJSON objects for Turf.
|
|
38
39
|
*
|
|
@@ -42,7 +43,7 @@ export declare function containsNumber(coordinates: any[]): boolean;
|
|
|
42
43
|
* @param {string} name name of calling function
|
|
43
44
|
* @throws {Error} if value is not the expected type.
|
|
44
45
|
*/
|
|
45
|
-
|
|
46
|
+
declare function geojsonType(value: any, type: string, name: string): void;
|
|
46
47
|
/**
|
|
47
48
|
* Enforce expectations about types of {@link Feature} inputs for Turf.
|
|
48
49
|
* Internally this uses {@link geojsonType} to judge geometry types.
|
|
@@ -53,7 +54,7 @@ export declare function geojsonType(value: any, type: string, name: string): voi
|
|
|
53
54
|
* @param {string} name name of calling function
|
|
54
55
|
* @throws {Error} error if value is not the expected type.
|
|
55
56
|
*/
|
|
56
|
-
|
|
57
|
+
declare function featureOf(feature: Feature<any>, type: string, name: string): void;
|
|
57
58
|
/**
|
|
58
59
|
* Enforce expectations about types of {@link FeatureCollection} inputs for Turf.
|
|
59
60
|
* Internally this uses {@link geojsonType} to judge geometry types.
|
|
@@ -64,7 +65,7 @@ export declare function featureOf(feature: Feature<any>, type: string, name: str
|
|
|
64
65
|
* @param {string} name name of calling function
|
|
65
66
|
* @throws {Error} if value is not the expected type.
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
declare function collectionOf(featureCollection: FeatureCollection<any>, type: string, name: string): void;
|
|
68
69
|
/**
|
|
69
70
|
* Get Geometry from Feature or Geometry Object
|
|
70
71
|
*
|
|
@@ -83,7 +84,7 @@ export declare function collectionOf(featureCollection: FeatureCollection<any>,
|
|
|
83
84
|
* var geom = turf.getGeom(point)
|
|
84
85
|
* //={"type": "Point", "coordinates": [110, 40]}
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
|
+
declare function getGeom<G extends Geometry>(geojson: Feature<G> | G): G;
|
|
87
88
|
/**
|
|
88
89
|
* Get GeoJSON object's type, Geometry type is prioritize.
|
|
89
90
|
*
|
|
@@ -102,4 +103,6 @@ export declare function getGeom<G extends Geometries | GeometryCollection>(geojs
|
|
|
102
103
|
* var geom = turf.getType(point)
|
|
103
104
|
* //="Point"
|
|
104
105
|
*/
|
|
105
|
-
|
|
106
|
+
declare function getType(geojson: Feature<any> | FeatureCollection<any> | Geometry, _name?: string): string;
|
|
107
|
+
|
|
108
|
+
export { collectionOf, containsNumber, featureOf, geojsonType, getCoord, getCoords, getGeom, getType };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { isNumber } from "@turf/helpers";
|
|
3
|
+
function getCoord(coord) {
|
|
4
|
+
if (!coord) {
|
|
5
|
+
throw new Error("coord is required");
|
|
6
|
+
}
|
|
7
|
+
if (!Array.isArray(coord)) {
|
|
8
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
9
|
+
return [...coord.geometry.coordinates];
|
|
10
|
+
}
|
|
11
|
+
if (coord.type === "Point") {
|
|
12
|
+
return [...coord.coordinates];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
16
|
+
return [...coord];
|
|
17
|
+
}
|
|
18
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
19
|
+
}
|
|
20
|
+
function getCoords(coords) {
|
|
21
|
+
if (Array.isArray(coords)) {
|
|
22
|
+
return coords;
|
|
23
|
+
}
|
|
24
|
+
if (coords.type === "Feature") {
|
|
25
|
+
if (coords.geometry !== null) {
|
|
26
|
+
return coords.geometry.coordinates;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
if (coords.coordinates) {
|
|
30
|
+
return coords.coordinates;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
throw new Error(
|
|
34
|
+
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function containsNumber(coordinates) {
|
|
38
|
+
if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(coordinates[0]) && coordinates[0].length) {
|
|
42
|
+
return containsNumber(coordinates[0]);
|
|
43
|
+
}
|
|
44
|
+
throw new Error("coordinates must only contain numbers");
|
|
45
|
+
}
|
|
46
|
+
function geojsonType(value, type, name) {
|
|
47
|
+
if (!type || !name) {
|
|
48
|
+
throw new Error("type and name required");
|
|
49
|
+
}
|
|
50
|
+
if (!value || value.type !== type) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
"Invalid input to " + name + ": must be a " + type + ", given " + value.type
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function featureOf(feature, type, name) {
|
|
57
|
+
if (!feature) {
|
|
58
|
+
throw new Error("No feature passed");
|
|
59
|
+
}
|
|
60
|
+
if (!name) {
|
|
61
|
+
throw new Error(".featureOf() requires a name");
|
|
62
|
+
}
|
|
63
|
+
if (!feature || feature.type !== "Feature" || !feature.geometry) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"Invalid input to " + name + ", Feature with geometry required"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (!feature.geometry || feature.geometry.type !== type) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
"Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function collectionOf(featureCollection, type, name) {
|
|
75
|
+
if (!featureCollection) {
|
|
76
|
+
throw new Error("No featureCollection passed");
|
|
77
|
+
}
|
|
78
|
+
if (!name) {
|
|
79
|
+
throw new Error(".collectionOf() requires a name");
|
|
80
|
+
}
|
|
81
|
+
if (!featureCollection || featureCollection.type !== "FeatureCollection") {
|
|
82
|
+
throw new Error(
|
|
83
|
+
"Invalid input to " + name + ", FeatureCollection required"
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
for (const feature of featureCollection.features) {
|
|
87
|
+
if (!feature || feature.type !== "Feature" || !feature.geometry) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
"Invalid input to " + name + ", Feature with geometry required"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (!feature.geometry || feature.geometry.type !== type) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
"Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function getGeom(geojson) {
|
|
100
|
+
if (geojson.type === "Feature") {
|
|
101
|
+
return geojson.geometry;
|
|
102
|
+
}
|
|
103
|
+
return geojson;
|
|
104
|
+
}
|
|
105
|
+
function getType(geojson, _name) {
|
|
106
|
+
if (geojson.type === "FeatureCollection") {
|
|
107
|
+
return "FeatureCollection";
|
|
108
|
+
}
|
|
109
|
+
if (geojson.type === "GeometryCollection") {
|
|
110
|
+
return "GeometryCollection";
|
|
111
|
+
}
|
|
112
|
+
if (geojson.type === "Feature" && geojson.geometry !== null) {
|
|
113
|
+
return geojson.geometry.type;
|
|
114
|
+
}
|
|
115
|
+
return geojson.type;
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
collectionOf,
|
|
119
|
+
containsNumber,
|
|
120
|
+
featureOf,
|
|
121
|
+
geojsonType,
|
|
122
|
+
getCoord,
|
|
123
|
+
getCoords,
|
|
124
|
+
getGeom,
|
|
125
|
+
getType
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import {\n Feature,\n FeatureCollection,\n Geometry,\n LineString,\n MultiPoint,\n MultiLineString,\n MultiPolygon,\n Point,\n Polygon,\n} from \"geojson\";\nimport { isNumber } from \"@turf/helpers\";\n\n/**\n * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.\n *\n * @name getCoord\n * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers\n * @returns {Array<number>} coordinates\n * @example\n * var pt = turf.point([10, 10]);\n *\n * var coord = turf.getCoord(pt);\n * //= [10, 10]\n */\nfunction getCoord(coord: Feature<Point> | Point | number[]): number[] {\n if (!coord) {\n throw new Error(\"coord is required\");\n }\n\n if (!Array.isArray(coord)) {\n if (\n coord.type === \"Feature\" &&\n coord.geometry !== null &&\n coord.geometry.type === \"Point\"\n ) {\n return [...coord.geometry.coordinates];\n }\n if (coord.type === \"Point\") {\n return [...coord.coordinates];\n }\n }\n if (\n Array.isArray(coord) &&\n coord.length >= 2 &&\n !Array.isArray(coord[0]) &&\n !Array.isArray(coord[1])\n ) {\n return [...coord];\n }\n\n throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\n\n/**\n * Unwrap coordinates from a Feature, Geometry Object or an Array\n *\n * @name getCoords\n * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array\n * @returns {Array<any>} coordinates\n * @example\n * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\n *\n * var coords = turf.getCoords(poly);\n * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\n */\nfunction getCoords<\n G extends\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon,\n>(coords: any[] | Feature<G> | G): any[] {\n if (Array.isArray(coords)) {\n return coords;\n }\n\n // Feature\n if (coords.type === \"Feature\") {\n if (coords.geometry !== null) {\n return coords.geometry.coordinates;\n }\n } else {\n // Geometry\n if (coords.coordinates) {\n return coords.coordinates;\n }\n }\n\n throw new Error(\n \"coords must be GeoJSON Feature, Geometry Object or an Array\"\n );\n}\n\n/**\n * Checks if coordinates contains a number\n *\n * @name containsNumber\n * @param {Array<any>} coordinates GeoJSON Coordinates\n * @returns {boolean} true if Array contains a number\n */\nfunction containsNumber(coordinates: any[]): boolean {\n if (\n coordinates.length > 1 &&\n isNumber(coordinates[0]) &&\n isNumber(coordinates[1])\n ) {\n return true;\n }\n\n if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n return containsNumber(coordinates[0]);\n }\n throw new Error(\"coordinates must only contain numbers\");\n}\n\n/**\n * Enforce expectations about types of GeoJSON objects for Turf.\n *\n * @name geojsonType\n * @param {GeoJSON} value any GeoJSON object\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction geojsonType(value: any, type: string, name: string): void {\n if (!type || !name) {\n throw new Error(\"type and name required\");\n }\n\n if (!value || value.type !== type) {\n throw new Error(\n \"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n value.type\n );\n }\n}\n\n/**\n * Enforce expectations about types of {@link Feature} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name featureOf\n * @param {Feature} feature a feature with an expected geometry type\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} error if value is not the expected type.\n */\nfunction featureOf(feature: Feature<any>, type: string, name: string): void {\n if (!feature) {\n throw new Error(\"No feature passed\");\n }\n if (!name) {\n throw new Error(\".featureOf() requires a name\");\n }\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n feature.geometry.type\n );\n }\n}\n\n/**\n * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name collectionOf\n * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction collectionOf(\n featureCollection: FeatureCollection<any>,\n type: string,\n name: string\n) {\n if (!featureCollection) {\n throw new Error(\"No featureCollection passed\");\n }\n if (!name) {\n throw new Error(\".collectionOf() requires a name\");\n }\n if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n throw new Error(\n \"Invalid input to \" + name + \", FeatureCollection required\"\n );\n }\n for (const feature of featureCollection.features) {\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\n \"Invalid input to \" + name + \", Feature with geometry required\"\n );\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\n \"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n feature.geometry.type\n );\n }\n }\n}\n\n/**\n * Get Geometry from Feature or Geometry Object\n *\n * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object\n * @returns {Geometry|null} GeoJSON Geometry Object\n * @throws {Error} if geojson is not a Feature or Geometry Object\n * @example\n * var point = {\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 40]\n * }\n * }\n * var geom = turf.getGeom(point)\n * //={\"type\": \"Point\", \"coordinates\": [110, 40]}\n */\nfunction getGeom<G extends Geometry>(geojson: Feature<G> | G): G {\n if (geojson.type === \"Feature\") {\n return geojson.geometry;\n }\n return geojson;\n}\n\n/**\n * Get GeoJSON object's type, Geometry type is prioritize.\n *\n * @param {GeoJSON} geojson GeoJSON object\n * @param {string} [name=\"geojson\"] name of the variable to display in error message (unused)\n * @returns {string} GeoJSON type\n * @example\n * var point = {\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 40]\n * }\n * }\n * var geom = turf.getType(point)\n * //=\"Point\"\n */\nfunction getType(\n geojson: Feature<any> | FeatureCollection<any> | Geometry,\n _name?: string\n): string {\n if (geojson.type === \"FeatureCollection\") {\n return \"FeatureCollection\";\n }\n if (geojson.type === \"GeometryCollection\") {\n return \"GeometryCollection\";\n }\n if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n return geojson.geometry.type;\n }\n return geojson.type;\n}\n\nexport {\n getCoord,\n getCoords,\n containsNumber,\n geojsonType,\n featureOf,\n collectionOf,\n getGeom,\n getType,\n};\n// No default export!\n"],"mappings":";AAWA,SAAS,gBAAgB;AAczB,SAAS,SAAS,OAAoD;AACpE,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,QACE,MAAM,SAAS,aACf,MAAM,aAAa,QACnB,MAAM,SAAS,SAAS,SACxB;AACA,aAAO,CAAC,GAAG,MAAM,SAAS,WAAW;AAAA,IACvC;AACA,QAAI,MAAM,SAAS,SAAS;AAC1B,aAAO,CAAC,GAAG,MAAM,WAAW;AAAA,IAC9B;AAAA,EACF;AACA,MACE,MAAM,QAAQ,KAAK,KACnB,MAAM,UAAU,KAChB,CAAC,MAAM,QAAQ,MAAM,CAAC,CAAC,KACvB,CAAC,MAAM,QAAQ,MAAM,CAAC,CAAC,GACvB;AACA,WAAO,CAAC,GAAG,KAAK;AAAA,EAClB;AAEA,QAAM,IAAI,MAAM,oDAAoD;AACtE;AAcA,SAAS,UAQP,QAAuC;AACvC,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,SAAS,WAAW;AAC7B,QAAI,OAAO,aAAa,MAAM;AAC5B,aAAO,OAAO,SAAS;AAAA,IACzB;AAAA,EACF,OAAO;AAEL,QAAI,OAAO,aAAa;AACtB,aAAO,OAAO;AAAA,IAChB;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;AASA,SAAS,eAAe,aAA6B;AACnD,MACE,YAAY,SAAS,KACrB,SAAS,YAAY,CAAC,CAAC,KACvB,SAAS,YAAY,CAAC,CAAC,GACvB;AACA,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,YAAY,CAAC,CAAC,KAAK,YAAY,CAAC,EAAE,QAAQ;AAC1D,WAAO,eAAe,YAAY,CAAC,CAAC;AAAA,EACtC;AACA,QAAM,IAAI,MAAM,uCAAuC;AACzD;AAWA,SAAS,YAAY,OAAY,MAAc,MAAoB;AACjE,MAAI,CAAC,QAAQ,CAAC,MAAM;AAClB,UAAM,IAAI,MAAM,wBAAwB;AAAA,EAC1C;AAEA,MAAI,CAAC,SAAS,MAAM,SAAS,MAAM;AACjC,UAAM,IAAI;AAAA,MACR,sBACE,OACA,iBACA,OACA,aACA,MAAM;AAAA,IACV;AAAA,EACF;AACF;AAYA,SAAS,UAAU,SAAuB,MAAc,MAAoB;AAC1E,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AACA,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AACA,MAAI,CAAC,WAAW,QAAQ,SAAS,aAAa,CAAC,QAAQ,UAAU;AAC/D,UAAM,IAAI;AAAA,MACR,sBAAsB,OAAO;AAAA,IAC/B;AAAA,EACF;AACA,MAAI,CAAC,QAAQ,YAAY,QAAQ,SAAS,SAAS,MAAM;AACvD,UAAM,IAAI;AAAA,MACR,sBACE,OACA,iBACA,OACA,aACA,QAAQ,SAAS;AAAA,IACrB;AAAA,EACF;AACF;AAYA,SAAS,aACP,mBACA,MACA,MACA;AACA,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AACA,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AACA,MAAI,CAAC,qBAAqB,kBAAkB,SAAS,qBAAqB;AACxE,UAAM,IAAI;AAAA,MACR,sBAAsB,OAAO;AAAA,IAC/B;AAAA,EACF;AACA,aAAW,WAAW,kBAAkB,UAAU;AAChD,QAAI,CAAC,WAAW,QAAQ,SAAS,aAAa,CAAC,QAAQ,UAAU;AAC/D,YAAM,IAAI;AAAA,QACR,sBAAsB,OAAO;AAAA,MAC/B;AAAA,IACF;AACA,QAAI,CAAC,QAAQ,YAAY,QAAQ,SAAS,SAAS,MAAM;AACvD,YAAM,IAAI;AAAA,QACR,sBACE,OACA,iBACA,OACA,aACA,QAAQ,SAAS;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;AAoBA,SAAS,QAA4B,SAA4B;AAC/D,MAAI,QAAQ,SAAS,WAAW;AAC9B,WAAO,QAAQ;AAAA,EACjB;AACA,SAAO;AACT;AAoBA,SAAS,QACP,SACA,OACQ;AACR,MAAI,QAAQ,SAAS,qBAAqB;AACxC,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,sBAAsB;AACzC,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,aAAa,QAAQ,aAAa,MAAM;AAC3D,WAAO,QAAQ,SAAS;AAAA,EAC1B;AACA,SAAO,QAAQ;AACjB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/invariant",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "turf invariant module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -25,40 +25,49 @@
|
|
|
25
25
|
"invariant",
|
|
26
26
|
"expectations"
|
|
27
27
|
],
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "dist/cjs/index.cjs",
|
|
30
|
+
"module": "dist/esm/index.js",
|
|
31
|
+
"types": "dist/esm/index.d.ts",
|
|
30
32
|
"exports": {
|
|
31
33
|
"./package.json": "./package.json",
|
|
32
34
|
".": {
|
|
33
|
-
"import":
|
|
34
|
-
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/esm/index.d.ts",
|
|
37
|
+
"default": "./dist/esm/index.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/cjs/index.d.cts",
|
|
41
|
+
"default": "./dist/cjs/index.cjs"
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
44
|
},
|
|
37
|
-
"types": "dist/js/index.d.ts",
|
|
38
45
|
"sideEffects": false,
|
|
39
46
|
"files": [
|
|
40
47
|
"dist"
|
|
41
48
|
],
|
|
42
49
|
"scripts": {
|
|
43
|
-
"bench": "
|
|
44
|
-
"build": "
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"test": "
|
|
49
|
-
"test:tape": "ts-node -r esm test.js",
|
|
50
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
50
|
+
"bench": "tsx bench.ts",
|
|
51
|
+
"build": "tsup --config ../../tsup.config.ts",
|
|
52
|
+
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
53
|
+
"test": "npm-run-all --npm-path npm test:*",
|
|
54
|
+
"test:tape": "tsx test.ts",
|
|
55
|
+
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
51
56
|
},
|
|
52
57
|
"devDependencies": {
|
|
53
|
-
"benchmark": "
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
58
|
+
"@types/benchmark": "^2.1.5",
|
|
59
|
+
"@types/tape": "^4.2.32",
|
|
60
|
+
"benchmark": "^2.1.4",
|
|
61
|
+
"npm-run-all": "^4.1.5",
|
|
62
|
+
"tape": "^5.7.2",
|
|
63
|
+
"tsup": "^8.0.1",
|
|
64
|
+
"tsx": "^4.6.2",
|
|
65
|
+
"typescript": "^5.2.2"
|
|
59
66
|
},
|
|
60
67
|
"dependencies": {
|
|
61
|
-
"@turf/helpers": "^
|
|
68
|
+
"@turf/helpers": "^7.1.0",
|
|
69
|
+
"@types/geojson": "^7946.0.10",
|
|
70
|
+
"tslib": "^2.6.2"
|
|
62
71
|
},
|
|
63
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef"
|
|
64
73
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/geojson`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for geojson (https://geojson.org/).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geojson.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Tue, 30 Jan 2024 21:35:45 GMT
|
|
12
|
+
* Dependencies: none
|
|
13
|
+
|
|
14
|
+
# Credits
|
|
15
|
+
These definitions were written by [Jacob Bruun](https://github.com/cobster), [Arne Schubert](https://github.com/atd-schubert), [Jeff Jacobson](https://github.com/JeffJacobson), [Ilia Choly](https://github.com/icholy), and [Dan Vanderkam](https://github.com/danvk).
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems
|
|
2
|
+
// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)}
|
|
3
|
+
|
|
4
|
+
export as namespace GeoJSON;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The valid values for the "type" property of GeoJSON geometry objects.
|
|
8
|
+
* https://tools.ietf.org/html/rfc7946#section-1.4
|
|
9
|
+
*/
|
|
10
|
+
export type GeoJsonGeometryTypes = Geometry["type"];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The value values for the "type" property of GeoJSON Objects.
|
|
14
|
+
* https://tools.ietf.org/html/rfc7946#section-1.4
|
|
15
|
+
*/
|
|
16
|
+
export type GeoJsonTypes = GeoJSON["type"];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Bounding box
|
|
20
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
21
|
+
*/
|
|
22
|
+
export type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A Position is an array of coordinates.
|
|
26
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.1
|
|
27
|
+
* Array should contain between two and three elements.
|
|
28
|
+
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
|
|
29
|
+
* but the current specification only allows X, Y, and (optionally) Z to be defined.
|
|
30
|
+
*/
|
|
31
|
+
export type Position = number[]; // [number, number] | [number, number, number];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The base GeoJSON object.
|
|
35
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
36
|
+
* The GeoJSON specification also allows foreign members
|
|
37
|
+
* (https://tools.ietf.org/html/rfc7946#section-6.1)
|
|
38
|
+
* Developers should use "&" type in TypeScript or extend the interface
|
|
39
|
+
* to add these foreign members.
|
|
40
|
+
*/
|
|
41
|
+
export interface GeoJsonObject {
|
|
42
|
+
// Don't include foreign members directly into this type def.
|
|
43
|
+
// in order to preserve type safety.
|
|
44
|
+
// [key: string]: any;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies the type of GeoJSON object.
|
|
47
|
+
*/
|
|
48
|
+
type: GeoJsonTypes;
|
|
49
|
+
/**
|
|
50
|
+
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
|
|
51
|
+
* The value of the bbox member is an array of length 2*n where n is the number of dimensions
|
|
52
|
+
* represented in the contained geometries, with all axes of the most southwesterly point
|
|
53
|
+
* followed by all axes of the more northeasterly point.
|
|
54
|
+
* The axes order of a bbox follows the axes order of geometries.
|
|
55
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
56
|
+
*/
|
|
57
|
+
bbox?: BBox | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Union of GeoJSON objects.
|
|
62
|
+
*/
|
|
63
|
+
export type GeoJSON = Geometry | Feature | FeatureCollection;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Geometry object.
|
|
67
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
68
|
+
*/
|
|
69
|
+
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
|
70
|
+
export type GeometryObject = Geometry;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Point geometry object.
|
|
74
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
75
|
+
*/
|
|
76
|
+
export interface Point extends GeoJsonObject {
|
|
77
|
+
type: "Point";
|
|
78
|
+
coordinates: Position;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* MultiPoint geometry object.
|
|
83
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
84
|
+
*/
|
|
85
|
+
export interface MultiPoint extends GeoJsonObject {
|
|
86
|
+
type: "MultiPoint";
|
|
87
|
+
coordinates: Position[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* LineString geometry object.
|
|
92
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
93
|
+
*/
|
|
94
|
+
export interface LineString extends GeoJsonObject {
|
|
95
|
+
type: "LineString";
|
|
96
|
+
coordinates: Position[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* MultiLineString geometry object.
|
|
101
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
102
|
+
*/
|
|
103
|
+
export interface MultiLineString extends GeoJsonObject {
|
|
104
|
+
type: "MultiLineString";
|
|
105
|
+
coordinates: Position[][];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Polygon geometry object.
|
|
110
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
111
|
+
*/
|
|
112
|
+
export interface Polygon extends GeoJsonObject {
|
|
113
|
+
type: "Polygon";
|
|
114
|
+
coordinates: Position[][];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* MultiPolygon geometry object.
|
|
119
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
120
|
+
*/
|
|
121
|
+
export interface MultiPolygon extends GeoJsonObject {
|
|
122
|
+
type: "MultiPolygon";
|
|
123
|
+
coordinates: Position[][][];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Geometry Collection
|
|
128
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.8
|
|
129
|
+
*/
|
|
130
|
+
export interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
|
|
131
|
+
type: "GeometryCollection";
|
|
132
|
+
geometries: G[];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type GeoJsonProperties = { [name: string]: any } | null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A feature object which contains a geometry and associated properties.
|
|
139
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2
|
|
140
|
+
*/
|
|
141
|
+
export interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
142
|
+
type: "Feature";
|
|
143
|
+
/**
|
|
144
|
+
* The feature's geometry
|
|
145
|
+
*/
|
|
146
|
+
geometry: G;
|
|
147
|
+
/**
|
|
148
|
+
* A value that uniquely identifies this feature in a
|
|
149
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2.
|
|
150
|
+
*/
|
|
151
|
+
id?: string | number | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Properties associated with this feature.
|
|
154
|
+
*/
|
|
155
|
+
properties: P;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A collection of feature objects.
|
|
160
|
+
* https://tools.ietf.org/html/rfc7946#section-3.3
|
|
161
|
+
*/
|
|
162
|
+
export interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
163
|
+
type: "FeatureCollection";
|
|
164
|
+
features: Array<Feature<G, P>>;
|
|
165
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/geojson",
|
|
3
|
+
"version": "7946.0.14",
|
|
4
|
+
"description": "TypeScript definitions for geojson",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geojson",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Jacob Bruun",
|
|
10
|
+
"githubUsername": "cobster",
|
|
11
|
+
"url": "https://github.com/cobster"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Arne Schubert",
|
|
15
|
+
"githubUsername": "atd-schubert",
|
|
16
|
+
"url": "https://github.com/atd-schubert"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Jeff Jacobson",
|
|
20
|
+
"githubUsername": "JeffJacobson",
|
|
21
|
+
"url": "https://github.com/JeffJacobson"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Ilia Choly",
|
|
25
|
+
"githubUsername": "icholy",
|
|
26
|
+
"url": "https://github.com/icholy"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Dan Vanderkam",
|
|
30
|
+
"githubUsername": "danvk",
|
|
31
|
+
"url": "https://github.com/danvk"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"main": "",
|
|
35
|
+
"types": "index.d.ts",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
39
|
+
"directory": "types/geojson"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {},
|
|
42
|
+
"dependencies": {},
|
|
43
|
+
"typesPublisherContentHash": "e753c16ee536e3e65aed04b36ad138bb5843a33ca9d9aae93a326e81b9513a9c",
|
|
44
|
+
"typeScriptVersion": "4.6"
|
|
45
|
+
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
1.20.3 / 2024-09-10
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
* deps: qs@6.13.0
|
|
5
|
+
* add `depth` option to customize the depth level in the parser
|
|
6
|
+
* IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
|
|
7
|
+
|
|
1
8
|
1.20.2 / 2023-02-21
|
|
2
9
|
===================
|
|
3
10
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
|
5
5
|
[![Build Status][ci-image]][ci-url]
|
|
6
6
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
7
|
+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
|
7
8
|
|
|
8
9
|
Node.js body parsing middleware.
|
|
9
10
|
|
|
@@ -277,6 +278,10 @@ The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`
|
|
|
277
278
|
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
|
278
279
|
encoding of the request. The parsing can be aborted by throwing an error.
|
|
279
280
|
|
|
281
|
+
#### depth
|
|
282
|
+
|
|
283
|
+
The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible.
|
|
284
|
+
|
|
280
285
|
## Errors
|
|
281
286
|
|
|
282
287
|
The middlewares provided by this module create errors using the
|
|
@@ -373,6 +378,10 @@ as well as in the `encoding` property. The `status` property is set to `415`,
|
|
|
373
378
|
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
|
374
379
|
property is set to the encoding that is unsupported.
|
|
375
380
|
|
|
381
|
+
### The input exceeded the depth
|
|
382
|
+
|
|
383
|
+
This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown.
|
|
384
|
+
|
|
376
385
|
## Examples
|
|
377
386
|
|
|
378
387
|
### Express/Connect top-level generic
|
|
@@ -463,3 +472,5 @@ app.use(bodyParser.text({ type: 'text/html' }))
|
|
|
463
472
|
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
|
|
464
473
|
[npm-url]: https://npmjs.org/package/body-parser
|
|
465
474
|
[npm-version-image]: https://badgen.net/npm/v/body-parser
|
|
475
|
+
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
|
476
|
+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|