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.
Files changed (124) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +7 -3
  3. package/examples/{feedback.json → Feedback.json} +1 -9
  4. package/examples/MouseCoordinates.json +159 -0
  5. package/examples/sidcEdgeIcon.json +158 -0
  6. package/node_modules/@turf/bezier-spline/README.md +15 -21
  7. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs +165 -0
  8. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -0
  9. package/node_modules/@turf/bezier-spline/dist/{es/index.js → cjs/index.d.cts} +9 -30
  10. package/node_modules/@turf/bezier-spline/dist/{js → esm}/index.d.ts +5 -3
  11. package/node_modules/@turf/bezier-spline/dist/esm/index.js +165 -0
  12. package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -0
  13. package/node_modules/@turf/bezier-spline/package.json +33 -25
  14. package/node_modules/@turf/helpers/README.md +231 -219
  15. package/node_modules/@turf/helpers/dist/cjs/index.cjs +308 -0
  16. package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -0
  17. package/node_modules/@turf/helpers/dist/{es/index.js → cjs/index.d.cts} +103 -303
  18. package/node_modules/@turf/helpers/dist/{js → esm}/index.d.ts +67 -53
  19. package/node_modules/@turf/helpers/dist/esm/index.js +308 -0
  20. package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -0
  21. package/node_modules/@turf/helpers/package.json +32 -22
  22. package/node_modules/@turf/invariant/README.md +47 -58
  23. package/node_modules/@turf/invariant/dist/cjs/index.cjs +127 -0
  24. package/node_modules/@turf/invariant/dist/cjs/index.cjs.map +1 -0
  25. package/node_modules/@turf/invariant/dist/cjs/index.d.cts +108 -0
  26. package/node_modules/@turf/invariant/dist/{js → esm}/index.d.ts +12 -9
  27. package/node_modules/@turf/invariant/dist/esm/index.js +127 -0
  28. package/node_modules/@turf/invariant/dist/esm/index.js.map +1 -0
  29. package/node_modules/@turf/invariant/package.json +31 -22
  30. package/node_modules/@types/geojson/LICENSE +21 -0
  31. package/node_modules/@types/geojson/README.md +15 -0
  32. package/node_modules/@types/geojson/index.d.ts +165 -0
  33. package/node_modules/@types/geojson/package.json +45 -0
  34. package/node_modules/body-parser/HISTORY.md +7 -0
  35. package/node_modules/body-parser/README.md +11 -0
  36. package/node_modules/body-parser/lib/types/urlencoded.js +30 -7
  37. package/node_modules/body-parser/package.json +2 -2
  38. package/node_modules/encodeurl/README.md +19 -38
  39. package/node_modules/encodeurl/index.js +1 -1
  40. package/node_modules/encodeurl/package.json +7 -7
  41. package/node_modules/express/History.md +27 -0
  42. package/node_modules/express/Readme.md +100 -6
  43. package/node_modules/express/lib/response.js +11 -10
  44. package/node_modules/express/package.json +11 -11
  45. package/node_modules/finalhandler/HISTORY.md +15 -0
  46. package/node_modules/finalhandler/README.md +2 -2
  47. package/node_modules/finalhandler/index.js +7 -2
  48. package/node_modules/finalhandler/package.json +8 -7
  49. package/node_modules/merge-descriptors/README.md +4 -3
  50. package/node_modules/merge-descriptors/index.js +3 -3
  51. package/node_modules/merge-descriptors/package.json +14 -7
  52. package/node_modules/mime-db/HISTORY.md +14 -0
  53. package/node_modules/mime-db/README.md +27 -24
  54. package/node_modules/mime-db/db.json +646 -62
  55. package/node_modules/mime-db/package.json +9 -13
  56. package/node_modules/mime-types/node_modules/mime-db/HISTORY.md +507 -0
  57. package/node_modules/mime-types/node_modules/mime-db/LICENSE +23 -0
  58. package/node_modules/mime-types/node_modules/mime-db/README.md +100 -0
  59. package/node_modules/mime-types/node_modules/mime-db/db.json +8519 -0
  60. package/node_modules/mime-types/node_modules/mime-db/index.js +12 -0
  61. package/node_modules/mime-types/node_modules/mime-db/package.json +60 -0
  62. package/node_modules/object-inspect/CHANGELOG.md +15 -0
  63. package/node_modules/object-inspect/index.js +4 -1
  64. package/node_modules/object-inspect/package.json +14 -9
  65. package/node_modules/object-inspect/readme.markdown +9 -11
  66. package/node_modules/path-to-regexp/index.js +57 -40
  67. package/node_modules/path-to-regexp/package.json +2 -2
  68. package/node_modules/qs/.editorconfig +3 -0
  69. package/node_modules/qs/.eslintrc +2 -2
  70. package/node_modules/qs/CHANGELOG.md +59 -5
  71. package/node_modules/qs/README.md +133 -49
  72. package/node_modules/qs/dist/qs.js +56 -2020
  73. package/node_modules/qs/lib/parse.js +46 -13
  74. package/node_modules/qs/lib/stringify.js +53 -28
  75. package/node_modules/qs/lib/utils.js +47 -34
  76. package/node_modules/qs/package.json +26 -12
  77. package/node_modules/qs/test/empty-keys-cases.js +267 -0
  78. package/node_modules/qs/test/parse.js +347 -32
  79. package/node_modules/qs/test/stringify.js +436 -47
  80. package/node_modules/send/HISTORY.md +5 -0
  81. package/node_modules/send/index.js +1 -2
  82. package/node_modules/send/node_modules/encodeurl/LICENSE +22 -0
  83. package/node_modules/send/node_modules/encodeurl/README.md +128 -0
  84. package/node_modules/send/node_modules/encodeurl/index.js +60 -0
  85. package/node_modules/send/node_modules/encodeurl/package.json +40 -0
  86. package/node_modules/send/package.json +1 -1
  87. package/node_modules/serve-static/HISTORY.md +16 -0
  88. package/node_modules/serve-static/index.js +1 -2
  89. package/node_modules/serve-static/package.json +3 -3
  90. package/node_modules/tslib/CopyrightNotice.txt +15 -0
  91. package/node_modules/tslib/LICENSE.txt +12 -0
  92. package/node_modules/tslib/README.md +164 -0
  93. package/node_modules/tslib/SECURITY.md +41 -0
  94. package/node_modules/tslib/modules/index.d.ts +37 -0
  95. package/node_modules/tslib/modules/index.js +68 -0
  96. package/node_modules/tslib/modules/package.json +3 -0
  97. package/node_modules/tslib/package.json +47 -0
  98. package/node_modules/tslib/tslib.d.ts +453 -0
  99. package/node_modules/tslib/tslib.es6.html +1 -0
  100. package/node_modules/tslib/tslib.es6.js +379 -0
  101. package/node_modules/tslib/tslib.es6.mjs +378 -0
  102. package/node_modules/tslib/tslib.html +1 -0
  103. package/node_modules/tslib/tslib.js +429 -0
  104. package/package.json +5 -5
  105. package/worldmap/index.html +1 -1
  106. package/worldmap/leaflet/leaflet.mousecoordinate.js +3 -3
  107. package/worldmap/worldmap.js +123 -36
  108. package/worldmap.html +1 -1
  109. package/worldmap.js +23 -4
  110. package/node_modules/@turf/bezier-spline/dist/es/lib/spline.js +0 -158
  111. package/node_modules/@turf/bezier-spline/dist/es/package.json +0 -1
  112. package/node_modules/@turf/bezier-spline/dist/js/index.js +0 -65
  113. package/node_modules/@turf/bezier-spline/dist/js/lib/spline.d.ts +0 -62
  114. package/node_modules/@turf/bezier-spline/dist/js/lib/spline.js +0 -160
  115. package/node_modules/@turf/helpers/dist/es/lib/geojson.js +0 -7
  116. package/node_modules/@turf/helpers/dist/es/package.json +0 -1
  117. package/node_modules/@turf/helpers/dist/js/index.js +0 -724
  118. package/node_modules/@turf/helpers/dist/js/lib/geojson.d.ts +0 -193
  119. package/node_modules/@turf/helpers/dist/js/lib/geojson.js +0 -9
  120. package/node_modules/@turf/invariant/dist/es/index.js +0 -223
  121. package/node_modules/@turf/invariant/dist/es/package.json +0 -1
  122. package/node_modules/@turf/invariant/dist/js/index.js +0 -233
  123. package/node_modules/path-to-regexp/History.md +0 -36
  124. /package/node_modules/{encodeurl → send/node_modules/encodeurl}/HISTORY.md +0 -0
@@ -1,193 +0,0 @@
1
- /**
2
- * GeometryTypes
3
- *
4
- * https://tools.ietf.org/html/rfc7946#section-1.4
5
- * The valid values for the "type" property of GeoJSON geometry objects.
6
- */
7
- export declare type GeometryTypes = "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | "GeometryCollection";
8
- export declare type CollectionTypes = "FeatureCollection" | "GeometryCollection";
9
- /**
10
- * Types
11
- *
12
- * https://tools.ietf.org/html/rfc7946#section-1.4
13
- * The value values for the "type" property of GeoJSON Objects.
14
- */
15
- export declare type Types = "Feature" | GeometryTypes | CollectionTypes;
16
- /**
17
- * Bounding box
18
- *
19
- * https://tools.ietf.org/html/rfc7946#section-5
20
- * A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections.
21
- * The value of the bbox member MUST be an array of length 2*n where n is the number of dimensions represented in the contained geometries,
22
- * with all axes of the most southwesterly point followed by all axes of the more northeasterly point.
23
- * The axes order of a bbox follows the axes order of geometries.
24
- */
25
- export declare type BBox2d = [number, number, number, number];
26
- export declare type BBox3d = [number, number, number, number, number, number];
27
- export declare type BBox = BBox2d | BBox3d;
28
- /**
29
- * Id
30
- *
31
- * https://tools.ietf.org/html/rfc7946#section-3.2
32
- * If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of
33
- * the Feature object with the name "id", and the value of this member is either a JSON string or number.
34
- */
35
- export declare type Id = string | number;
36
- /**
37
- * Position
38
- *
39
- * https://tools.ietf.org/html/rfc7946#section-3.1.1
40
- * Array should contain between two and three elements.
41
- * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
42
- * but the current specification only allows X, Y, and (optionally) Z to be defined.
43
- */
44
- export declare type Position = number[];
45
- /**
46
- * Properties
47
- *
48
- * https://tools.ietf.org/html/rfc7946#section-3.2
49
- * A Feature object has a member with the name "properties".
50
- * The value of the properties member is an object (any JSON object or a JSON null value).
51
- */
52
- export declare type Properties = {
53
- [name: string]: any;
54
- } | null;
55
- /**
56
- * Geometries
57
- */
58
- export declare type Geometries = Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon;
59
- /**
60
- * GeoJSON Object
61
- *
62
- * https://tools.ietf.org/html/rfc7946#section-3
63
- * The GeoJSON specification also allows [foreign members](https://tools.ietf.org/html/rfc7946#section-6.1)
64
- * Developers should use "&" type in TypeScript or extend the interface to add these foreign members.
65
- */
66
- export interface GeoJSONObject {
67
- /**
68
- * Specifies the type of GeoJSON object.
69
- */
70
- type: string;
71
- /**
72
- * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
73
- * https://tools.ietf.org/html/rfc7946#section-5
74
- */
75
- bbox?: BBox;
76
- }
77
- /**
78
- * Geometry Object
79
- *
80
- * https://tools.ietf.org/html/rfc7946#section-3
81
- */
82
- export interface GeometryObject extends GeoJSONObject {
83
- type: GeometryTypes;
84
- }
85
- /**
86
- * Geometry
87
- *
88
- * https://tools.ietf.org/html/rfc7946#section-3
89
- */
90
- export interface Geometry extends GeoJSONObject {
91
- coordinates: Position | Position[] | Position[][] | Position[][][];
92
- }
93
- /**
94
- * Point Geometry Object
95
- *
96
- * https://tools.ietf.org/html/rfc7946#section-3.1.2
97
- */
98
- export interface Point extends GeometryObject {
99
- type: "Point";
100
- coordinates: Position;
101
- }
102
- /**
103
- * MultiPoint Geometry Object
104
- *
105
- * https://tools.ietf.org/html/rfc7946#section-3.1.3
106
- */
107
- export interface MultiPoint extends GeometryObject {
108
- type: "MultiPoint";
109
- coordinates: Position[];
110
- }
111
- /**
112
- * LineString Geometry Object
113
- *
114
- * https://tools.ietf.org/html/rfc7946#section-3.1.4
115
- */
116
- export interface LineString extends GeometryObject {
117
- type: "LineString";
118
- coordinates: Position[];
119
- }
120
- /**
121
- * MultiLineString Geometry Object
122
- *
123
- * https://tools.ietf.org/html/rfc7946#section-3.1.5
124
- */
125
- export interface MultiLineString extends GeometryObject {
126
- type: "MultiLineString";
127
- coordinates: Position[][];
128
- }
129
- /**
130
- * Polygon Geometry Object
131
- *
132
- * https://tools.ietf.org/html/rfc7946#section-3.1.6
133
- */
134
- export interface Polygon extends GeometryObject {
135
- type: "Polygon";
136
- coordinates: Position[][];
137
- }
138
- /**
139
- * MultiPolygon Geometry Object
140
- *
141
- * https://tools.ietf.org/html/rfc7946#section-3.1.7
142
- */
143
- export interface MultiPolygon extends GeometryObject {
144
- type: "MultiPolygon";
145
- coordinates: Position[][][];
146
- }
147
- /**
148
- * GeometryCollection
149
- *
150
- * https://tools.ietf.org/html/rfc7946#section-3.1.8
151
- *
152
- * A GeoJSON object with type "GeometryCollection" is a Geometry object.
153
- * A GeometryCollection has a member with the name "geometries".
154
- * The value of "geometries" is an array. Each element of this array is a GeoJSON Geometry object.
155
- * It is possible for this array to be empty.
156
- */
157
- export interface GeometryCollection extends GeometryObject {
158
- type: "GeometryCollection";
159
- geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>;
160
- }
161
- /**
162
- * Feature
163
- *
164
- * https://tools.ietf.org/html/rfc7946#section-3.2
165
- * A Feature object represents a spatially bounded thing.
166
- * Every Feature object is a GeoJSON object no matter where it occurs in a GeoJSON text.
167
- */
168
- export interface Feature<G = Geometry | GeometryCollection, P = Properties> extends GeoJSONObject {
169
- type: "Feature";
170
- geometry: G;
171
- /**
172
- * A value that uniquely identifies this feature in a
173
- * https://tools.ietf.org/html/rfc7946#section-3.2.
174
- */
175
- id?: Id;
176
- /**
177
- * Properties associated with this feature.
178
- */
179
- properties: P;
180
- }
181
- /**
182
- * Feature Collection
183
- *
184
- * https://tools.ietf.org/html/rfc7946#section-3.3
185
- * A GeoJSON object with the type "FeatureCollection" is a FeatureCollection object.
186
- * A FeatureCollection object has a member with the name "features".
187
- * The value of "features" is a JSON array. Each element of the array is a Feature object as defined above.
188
- * It is possible for this array to be empty.
189
- */
190
- export interface FeatureCollection<G = Geometry | GeometryCollection, P = Properties> extends GeoJSONObject {
191
- type: "FeatureCollection";
192
- features: Array<Feature<G, P>>;
193
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- // Type definitions for geojson 7946.0
3
- // Project: https://geojson.org/
4
- // Definitions by: Jacob Bruun <https://github.com/cobster>
5
- // Arne Schubert <https://github.com/atd-schubert>
6
- // Jeff Jacobson <https://github.com/JeffJacobson>
7
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
- // TypeScript Version: 2.3
9
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,223 +0,0 @@
1
- import { isNumber, } from "@turf/helpers";
2
- /**
3
- * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
4
- *
5
- * @name getCoord
6
- * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers
7
- * @returns {Array<number>} coordinates
8
- * @example
9
- * var pt = turf.point([10, 10]);
10
- *
11
- * var coord = turf.getCoord(pt);
12
- * //= [10, 10]
13
- */
14
- export function getCoord(coord) {
15
- if (!coord) {
16
- throw new Error("coord is required");
17
- }
18
- if (!Array.isArray(coord)) {
19
- if (coord.type === "Feature" &&
20
- coord.geometry !== null &&
21
- coord.geometry.type === "Point") {
22
- return coord.geometry.coordinates;
23
- }
24
- if (coord.type === "Point") {
25
- return coord.coordinates;
26
- }
27
- }
28
- if (Array.isArray(coord) &&
29
- coord.length >= 2 &&
30
- !Array.isArray(coord[0]) &&
31
- !Array.isArray(coord[1])) {
32
- return coord;
33
- }
34
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
35
- }
36
- /**
37
- * Unwrap coordinates from a Feature, Geometry Object or an Array
38
- *
39
- * @name getCoords
40
- * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array
41
- * @returns {Array<any>} coordinates
42
- * @example
43
- * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);
44
- *
45
- * var coords = turf.getCoords(poly);
46
- * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]
47
- */
48
- export function getCoords(coords) {
49
- if (Array.isArray(coords)) {
50
- return coords;
51
- }
52
- // Feature
53
- if (coords.type === "Feature") {
54
- if (coords.geometry !== null) {
55
- return coords.geometry.coordinates;
56
- }
57
- }
58
- else {
59
- // Geometry
60
- if (coords.coordinates) {
61
- return coords.coordinates;
62
- }
63
- }
64
- throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
65
- }
66
- /**
67
- * Checks if coordinates contains a number
68
- *
69
- * @name containsNumber
70
- * @param {Array<any>} coordinates GeoJSON Coordinates
71
- * @returns {boolean} true if Array contains a number
72
- */
73
- export function containsNumber(coordinates) {
74
- if (coordinates.length > 1 &&
75
- isNumber(coordinates[0]) &&
76
- isNumber(coordinates[1])) {
77
- return true;
78
- }
79
- if (Array.isArray(coordinates[0]) && coordinates[0].length) {
80
- return containsNumber(coordinates[0]);
81
- }
82
- throw new Error("coordinates must only contain numbers");
83
- }
84
- /**
85
- * Enforce expectations about types of GeoJSON objects for Turf.
86
- *
87
- * @name geojsonType
88
- * @param {GeoJSON} value any GeoJSON object
89
- * @param {string} type expected GeoJSON type
90
- * @param {string} name name of calling function
91
- * @throws {Error} if value is not the expected type.
92
- */
93
- export function geojsonType(value, type, name) {
94
- if (!type || !name) {
95
- throw new Error("type and name required");
96
- }
97
- if (!value || value.type !== type) {
98
- throw new Error("Invalid input to " +
99
- name +
100
- ": must be a " +
101
- type +
102
- ", given " +
103
- value.type);
104
- }
105
- }
106
- /**
107
- * Enforce expectations about types of {@link Feature} inputs for Turf.
108
- * Internally this uses {@link geojsonType} to judge geometry types.
109
- *
110
- * @name featureOf
111
- * @param {Feature} feature a feature with an expected geometry type
112
- * @param {string} type expected GeoJSON type
113
- * @param {string} name name of calling function
114
- * @throws {Error} error if value is not the expected type.
115
- */
116
- export function featureOf(feature, type, name) {
117
- if (!feature) {
118
- throw new Error("No feature passed");
119
- }
120
- if (!name) {
121
- throw new Error(".featureOf() requires a name");
122
- }
123
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
124
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
125
- }
126
- if (!feature.geometry || feature.geometry.type !== type) {
127
- throw new Error("Invalid input to " +
128
- name +
129
- ": must be a " +
130
- type +
131
- ", given " +
132
- feature.geometry.type);
133
- }
134
- }
135
- /**
136
- * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.
137
- * Internally this uses {@link geojsonType} to judge geometry types.
138
- *
139
- * @name collectionOf
140
- * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged
141
- * @param {string} type expected GeoJSON type
142
- * @param {string} name name of calling function
143
- * @throws {Error} if value is not the expected type.
144
- */
145
- export function collectionOf(featureCollection, type, name) {
146
- if (!featureCollection) {
147
- throw new Error("No featureCollection passed");
148
- }
149
- if (!name) {
150
- throw new Error(".collectionOf() requires a name");
151
- }
152
- if (!featureCollection || featureCollection.type !== "FeatureCollection") {
153
- throw new Error("Invalid input to " + name + ", FeatureCollection required");
154
- }
155
- for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {
156
- var feature = _a[_i];
157
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
158
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
159
- }
160
- if (!feature.geometry || feature.geometry.type !== type) {
161
- throw new Error("Invalid input to " +
162
- name +
163
- ": must be a " +
164
- type +
165
- ", given " +
166
- feature.geometry.type);
167
- }
168
- }
169
- }
170
- /**
171
- * Get Geometry from Feature or Geometry Object
172
- *
173
- * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object
174
- * @returns {Geometry|null} GeoJSON Geometry Object
175
- * @throws {Error} if geojson is not a Feature or Geometry Object
176
- * @example
177
- * var point = {
178
- * "type": "Feature",
179
- * "properties": {},
180
- * "geometry": {
181
- * "type": "Point",
182
- * "coordinates": [110, 40]
183
- * }
184
- * }
185
- * var geom = turf.getGeom(point)
186
- * //={"type": "Point", "coordinates": [110, 40]}
187
- */
188
- export function getGeom(geojson) {
189
- if (geojson.type === "Feature") {
190
- return geojson.geometry;
191
- }
192
- return geojson;
193
- }
194
- /**
195
- * Get GeoJSON object's type, Geometry type is prioritize.
196
- *
197
- * @param {GeoJSON} geojson GeoJSON object
198
- * @param {string} [name="geojson"] name of the variable to display in error message (unused)
199
- * @returns {string} GeoJSON type
200
- * @example
201
- * var point = {
202
- * "type": "Feature",
203
- * "properties": {},
204
- * "geometry": {
205
- * "type": "Point",
206
- * "coordinates": [110, 40]
207
- * }
208
- * }
209
- * var geom = turf.getType(point)
210
- * //="Point"
211
- */
212
- export function getType(geojson, _name) {
213
- if (geojson.type === "FeatureCollection") {
214
- return "FeatureCollection";
215
- }
216
- if (geojson.type === "GeometryCollection") {
217
- return "GeometryCollection";
218
- }
219
- if (geojson.type === "Feature" && geojson.geometry !== null) {
220
- return geojson.geometry.type;
221
- }
222
- return geojson.type;
223
- }
@@ -1 +0,0 @@
1
- {"type":"module"}
@@ -1,233 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var helpers_1 = require("@turf/helpers");
4
- /**
5
- * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
6
- *
7
- * @name getCoord
8
- * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers
9
- * @returns {Array<number>} coordinates
10
- * @example
11
- * var pt = turf.point([10, 10]);
12
- *
13
- * var coord = turf.getCoord(pt);
14
- * //= [10, 10]
15
- */
16
- function getCoord(coord) {
17
- if (!coord) {
18
- throw new Error("coord is required");
19
- }
20
- if (!Array.isArray(coord)) {
21
- if (coord.type === "Feature" &&
22
- coord.geometry !== null &&
23
- coord.geometry.type === "Point") {
24
- return coord.geometry.coordinates;
25
- }
26
- if (coord.type === "Point") {
27
- return coord.coordinates;
28
- }
29
- }
30
- if (Array.isArray(coord) &&
31
- coord.length >= 2 &&
32
- !Array.isArray(coord[0]) &&
33
- !Array.isArray(coord[1])) {
34
- return coord;
35
- }
36
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
37
- }
38
- exports.getCoord = getCoord;
39
- /**
40
- * Unwrap coordinates from a Feature, Geometry Object or an Array
41
- *
42
- * @name getCoords
43
- * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array
44
- * @returns {Array<any>} coordinates
45
- * @example
46
- * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);
47
- *
48
- * var coords = turf.getCoords(poly);
49
- * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]
50
- */
51
- function getCoords(coords) {
52
- if (Array.isArray(coords)) {
53
- return coords;
54
- }
55
- // Feature
56
- if (coords.type === "Feature") {
57
- if (coords.geometry !== null) {
58
- return coords.geometry.coordinates;
59
- }
60
- }
61
- else {
62
- // Geometry
63
- if (coords.coordinates) {
64
- return coords.coordinates;
65
- }
66
- }
67
- throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
68
- }
69
- exports.getCoords = getCoords;
70
- /**
71
- * Checks if coordinates contains a number
72
- *
73
- * @name containsNumber
74
- * @param {Array<any>} coordinates GeoJSON Coordinates
75
- * @returns {boolean} true if Array contains a number
76
- */
77
- function containsNumber(coordinates) {
78
- if (coordinates.length > 1 &&
79
- helpers_1.isNumber(coordinates[0]) &&
80
- helpers_1.isNumber(coordinates[1])) {
81
- return true;
82
- }
83
- if (Array.isArray(coordinates[0]) && coordinates[0].length) {
84
- return containsNumber(coordinates[0]);
85
- }
86
- throw new Error("coordinates must only contain numbers");
87
- }
88
- exports.containsNumber = containsNumber;
89
- /**
90
- * Enforce expectations about types of GeoJSON objects for Turf.
91
- *
92
- * @name geojsonType
93
- * @param {GeoJSON} value any GeoJSON object
94
- * @param {string} type expected GeoJSON type
95
- * @param {string} name name of calling function
96
- * @throws {Error} if value is not the expected type.
97
- */
98
- function geojsonType(value, type, name) {
99
- if (!type || !name) {
100
- throw new Error("type and name required");
101
- }
102
- if (!value || value.type !== type) {
103
- throw new Error("Invalid input to " +
104
- name +
105
- ": must be a " +
106
- type +
107
- ", given " +
108
- value.type);
109
- }
110
- }
111
- exports.geojsonType = geojsonType;
112
- /**
113
- * Enforce expectations about types of {@link Feature} inputs for Turf.
114
- * Internally this uses {@link geojsonType} to judge geometry types.
115
- *
116
- * @name featureOf
117
- * @param {Feature} feature a feature with an expected geometry type
118
- * @param {string} type expected GeoJSON type
119
- * @param {string} name name of calling function
120
- * @throws {Error} error if value is not the expected type.
121
- */
122
- function featureOf(feature, type, name) {
123
- if (!feature) {
124
- throw new Error("No feature passed");
125
- }
126
- if (!name) {
127
- throw new Error(".featureOf() requires a name");
128
- }
129
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
130
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
131
- }
132
- if (!feature.geometry || feature.geometry.type !== type) {
133
- throw new Error("Invalid input to " +
134
- name +
135
- ": must be a " +
136
- type +
137
- ", given " +
138
- feature.geometry.type);
139
- }
140
- }
141
- exports.featureOf = featureOf;
142
- /**
143
- * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.
144
- * Internally this uses {@link geojsonType} to judge geometry types.
145
- *
146
- * @name collectionOf
147
- * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged
148
- * @param {string} type expected GeoJSON type
149
- * @param {string} name name of calling function
150
- * @throws {Error} if value is not the expected type.
151
- */
152
- function collectionOf(featureCollection, type, name) {
153
- if (!featureCollection) {
154
- throw new Error("No featureCollection passed");
155
- }
156
- if (!name) {
157
- throw new Error(".collectionOf() requires a name");
158
- }
159
- if (!featureCollection || featureCollection.type !== "FeatureCollection") {
160
- throw new Error("Invalid input to " + name + ", FeatureCollection required");
161
- }
162
- for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {
163
- var feature = _a[_i];
164
- if (!feature || feature.type !== "Feature" || !feature.geometry) {
165
- throw new Error("Invalid input to " + name + ", Feature with geometry required");
166
- }
167
- if (!feature.geometry || feature.geometry.type !== type) {
168
- throw new Error("Invalid input to " +
169
- name +
170
- ": must be a " +
171
- type +
172
- ", given " +
173
- feature.geometry.type);
174
- }
175
- }
176
- }
177
- exports.collectionOf = collectionOf;
178
- /**
179
- * Get Geometry from Feature or Geometry Object
180
- *
181
- * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object
182
- * @returns {Geometry|null} GeoJSON Geometry Object
183
- * @throws {Error} if geojson is not a Feature or Geometry Object
184
- * @example
185
- * var point = {
186
- * "type": "Feature",
187
- * "properties": {},
188
- * "geometry": {
189
- * "type": "Point",
190
- * "coordinates": [110, 40]
191
- * }
192
- * }
193
- * var geom = turf.getGeom(point)
194
- * //={"type": "Point", "coordinates": [110, 40]}
195
- */
196
- function getGeom(geojson) {
197
- if (geojson.type === "Feature") {
198
- return geojson.geometry;
199
- }
200
- return geojson;
201
- }
202
- exports.getGeom = getGeom;
203
- /**
204
- * Get GeoJSON object's type, Geometry type is prioritize.
205
- *
206
- * @param {GeoJSON} geojson GeoJSON object
207
- * @param {string} [name="geojson"] name of the variable to display in error message (unused)
208
- * @returns {string} GeoJSON type
209
- * @example
210
- * var point = {
211
- * "type": "Feature",
212
- * "properties": {},
213
- * "geometry": {
214
- * "type": "Point",
215
- * "coordinates": [110, 40]
216
- * }
217
- * }
218
- * var geom = turf.getType(point)
219
- * //="Point"
220
- */
221
- function getType(geojson, _name) {
222
- if (geojson.type === "FeatureCollection") {
223
- return "FeatureCollection";
224
- }
225
- if (geojson.type === "GeometryCollection") {
226
- return "GeometryCollection";
227
- }
228
- if (geojson.type === "Feature" && geojson.geometry !== null) {
229
- return geojson.geometry.type;
230
- }
231
- return geojson.type;
232
- }
233
- exports.getType = getType;
@@ -1,36 +0,0 @@
1
- 0.1.7 / 2015-07-28
2
- ==================
3
-
4
- * Fixed regression with escaped round brackets and matching groups.
5
-
6
- 0.1.6 / 2015-06-19
7
- ==================
8
-
9
- * Replace `index` feature by outputting all parameters, unnamed and named.
10
-
11
- 0.1.5 / 2015-05-08
12
- ==================
13
-
14
- * Add an index property for position in match result.
15
-
16
- 0.1.4 / 2015-03-05
17
- ==================
18
-
19
- * Add license information
20
-
21
- 0.1.3 / 2014-07-06
22
- ==================
23
-
24
- * Better array support
25
- * Improved support for trailing slash in non-ending mode
26
-
27
- 0.1.0 / 2014-03-06
28
- ==================
29
-
30
- * add options.end
31
-
32
- 0.0.2 / 2013-02-10
33
- ==================
34
-
35
- * Update to match current express
36
- * add .license property to component.json