node-red-contrib-web-worldmap 4.9.0 → 5.0.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +6 -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,81 +1,49 @@
1
+ import { Feature, Point, Position, LineString, MultiLineString, Polygon, MultiPolygon, FeatureCollection, Geometry, GeometryCollection, GeometryObject, GeoJsonProperties, BBox, MultiPoint } from 'geojson';
2
+
3
+ /**
4
+ * Id
5
+ *
6
+ * https://tools.ietf.org/html/rfc7946#section-3.2
7
+ * If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of
8
+ * the Feature object with the name "id", and the value of this member is either a JSON string or number.
9
+ *
10
+ * Should be contributed to @types/geojson
11
+ */
12
+ type Id = string | number;
13
+
14
+ type Coord = Feature<Point> | Point | Position;
15
+ type Units = "meters" | "metres" | "millimeters" | "millimetres" | "centimeters" | "centimetres" | "kilometers" | "kilometres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees";
16
+ type AreaUnits = Exclude<Units, "radians" | "degrees"> | "acres" | "hectares";
17
+ type Grid = "point" | "square" | "hex" | "triangle";
18
+ type Corners = "sw" | "se" | "nw" | "ne" | "center" | "centroid";
19
+ type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
20
+ type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
1
21
  /**
2
22
  * @module helpers
3
23
  */
4
24
  /**
5
- * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
6
- *
25
+ * The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The {@link https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius mean radius} was selected because it is {@link https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended recommended } by the Haversine formula (used by turf/distance) to reduce error.
7
26
  * @memberof helpers
8
27
  * @type {number}
9
28
  */
10
- export var earthRadius = 6371008.8;
29
+ declare const earthRadius = 6371008.8;
11
30
  /**
12
- * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
31
+ * Unit of measurement factors based on earthRadius.
13
32
  *
14
- * @memberof helpers
15
- * @type {Object}
16
- */
17
- export var factors = {
18
- centimeters: earthRadius * 100,
19
- centimetres: earthRadius * 100,
20
- degrees: earthRadius / 111325,
21
- feet: earthRadius * 3.28084,
22
- inches: earthRadius * 39.37,
23
- kilometers: earthRadius / 1000,
24
- kilometres: earthRadius / 1000,
25
- meters: earthRadius,
26
- metres: earthRadius,
27
- miles: earthRadius / 1609.344,
28
- millimeters: earthRadius * 1000,
29
- millimetres: earthRadius * 1000,
30
- nauticalmiles: earthRadius / 1852,
31
- radians: 1,
32
- yards: earthRadius * 1.0936,
33
- };
34
- /**
35
- * Units of measurement factors based on 1 meter.
33
+ * Keys are the name of the unit, values are the number of that unit in a single radian
36
34
  *
37
35
  * @memberof helpers
38
36
  * @type {Object}
39
37
  */
40
- export var unitsFactors = {
41
- centimeters: 100,
42
- centimetres: 100,
43
- degrees: 1 / 111325,
44
- feet: 3.28084,
45
- inches: 39.37,
46
- kilometers: 1 / 1000,
47
- kilometres: 1 / 1000,
48
- meters: 1,
49
- metres: 1,
50
- miles: 1 / 1609.344,
51
- millimeters: 1000,
52
- millimetres: 1000,
53
- nauticalmiles: 1 / 1852,
54
- radians: 1 / earthRadius,
55
- yards: 1.0936133,
56
- };
38
+ declare const factors: Record<Units, number>;
57
39
  /**
40
+
58
41
  * Area of measurement factors based on 1 square meter.
59
42
  *
60
43
  * @memberof helpers
61
44
  * @type {Object}
62
45
  */
63
- export var areaFactors = {
64
- acres: 0.000247105,
65
- centimeters: 10000,
66
- centimetres: 10000,
67
- feet: 10.763910417,
68
- hectares: 0.0001,
69
- inches: 1550.003100006,
70
- kilometers: 0.000001,
71
- kilometres: 0.000001,
72
- meters: 1,
73
- metres: 1,
74
- miles: 3.86e-7,
75
- millimeters: 1000000,
76
- millimetres: 1000000,
77
- yards: 1.195990046,
78
- };
46
+ declare const areaFactors: Record<AreaUnits, number>;
79
47
  /**
80
48
  * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
81
49
  *
@@ -96,19 +64,10 @@ export var areaFactors = {
96
64
  *
97
65
  * //=feature
98
66
  */
99
- export function feature(geom, properties, options) {
100
- if (options === void 0) { options = {}; }
101
- var feat = { type: "Feature" };
102
- if (options.id === 0 || options.id) {
103
- feat.id = options.id;
104
- }
105
- if (options.bbox) {
106
- feat.bbox = options.bbox;
107
- }
108
- feat.properties = properties || {};
109
- feat.geometry = geom;
110
- return feat;
111
- }
67
+ declare function feature<G extends GeometryObject = Geometry, P extends GeoJsonProperties = GeoJsonProperties>(geom: G | null, properties?: P, options?: {
68
+ bbox?: BBox;
69
+ id?: Id;
70
+ }): Feature<G, P>;
112
71
  /**
113
72
  * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.
114
73
  * For GeometryCollection type use `helpers.geometryCollection`
@@ -124,25 +83,7 @@ export function feature(geom, properties, options) {
124
83
  * var geometry = turf.geometry(type, coordinates);
125
84
  * // => geometry
126
85
  */
127
- export function geometry(type, coordinates, _options) {
128
- if (_options === void 0) { _options = {}; }
129
- switch (type) {
130
- case "Point":
131
- return point(coordinates).geometry;
132
- case "LineString":
133
- return lineString(coordinates).geometry;
134
- case "Polygon":
135
- return polygon(coordinates).geometry;
136
- case "MultiPoint":
137
- return multiPoint(coordinates).geometry;
138
- case "MultiLineString":
139
- return multiLineString(coordinates).geometry;
140
- case "MultiPolygon":
141
- return multiPolygon(coordinates).geometry;
142
- default:
143
- throw new Error(type + " is invalid");
144
- }
145
- }
86
+ declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], _options?: Record<string, never>): Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
146
87
  /**
147
88
  * Creates a {@link Point} {@link Feature} from a Position.
148
89
  *
@@ -158,26 +99,10 @@ export function geometry(type, coordinates, _options) {
158
99
  *
159
100
  * //=point
160
101
  */
161
- export function point(coordinates, properties, options) {
162
- if (options === void 0) { options = {}; }
163
- if (!coordinates) {
164
- throw new Error("coordinates is required");
165
- }
166
- if (!Array.isArray(coordinates)) {
167
- throw new Error("coordinates must be an Array");
168
- }
169
- if (coordinates.length < 2) {
170
- throw new Error("coordinates must be at least 2 numbers long");
171
- }
172
- if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {
173
- throw new Error("coordinates must contain numbers");
174
- }
175
- var geom = {
176
- type: "Point",
177
- coordinates: coordinates,
178
- };
179
- return feature(geom, properties, options);
180
- }
102
+ declare function point<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position, properties?: P, options?: {
103
+ bbox?: BBox;
104
+ id?: Id;
105
+ }): Feature<Point, P>;
181
106
  /**
182
107
  * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.
183
108
  *
@@ -198,12 +123,10 @@ export function point(coordinates, properties, options) {
198
123
  *
199
124
  * //=points
200
125
  */
201
- export function points(coordinates, properties, options) {
202
- if (options === void 0) { options = {}; }
203
- return featureCollection(coordinates.map(function (coords) {
204
- return point(coords, properties);
205
- }), options);
206
- }
126
+ declare function points<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
127
+ bbox?: BBox;
128
+ id?: Id;
129
+ }): FeatureCollection<Point, P>;
207
130
  /**
208
131
  * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.
209
132
  *
@@ -219,26 +142,10 @@ export function points(coordinates, properties, options) {
219
142
  *
220
143
  * //=polygon
221
144
  */
222
- export function polygon(coordinates, properties, options) {
223
- if (options === void 0) { options = {}; }
224
- for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
225
- var ring = coordinates_1[_i];
226
- if (ring.length < 4) {
227
- throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
228
- }
229
- for (var j = 0; j < ring[ring.length - 1].length; j++) {
230
- // Check if first point of Polygon contains two numbers
231
- if (ring[ring.length - 1][j] !== ring[0][j]) {
232
- throw new Error("First and last Position are not equivalent.");
233
- }
234
- }
235
- }
236
- var geom = {
237
- type: "Polygon",
238
- coordinates: coordinates,
239
- };
240
- return feature(geom, properties, options);
241
- }
145
+ declare function polygon<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
146
+ bbox?: BBox;
147
+ id?: Id;
148
+ }): Feature<Polygon, P>;
242
149
  /**
243
150
  * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.
244
151
  *
@@ -257,12 +164,10 @@ export function polygon(coordinates, properties, options) {
257
164
  *
258
165
  * //=polygons
259
166
  */
260
- export function polygons(coordinates, properties, options) {
261
- if (options === void 0) { options = {}; }
262
- return featureCollection(coordinates.map(function (coords) {
263
- return polygon(coords, properties);
264
- }), options);
265
- }
167
+ declare function polygons<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[][][], properties?: P, options?: {
168
+ bbox?: BBox;
169
+ id?: Id;
170
+ }): FeatureCollection<Polygon, P>;
266
171
  /**
267
172
  * Creates a {@link LineString} {@link Feature} from an Array of Positions.
268
173
  *
@@ -280,17 +185,10 @@ export function polygons(coordinates, properties, options) {
280
185
  * //=linestring1
281
186
  * //=linestring2
282
187
  */
283
- export function lineString(coordinates, properties, options) {
284
- if (options === void 0) { options = {}; }
285
- if (coordinates.length < 2) {
286
- throw new Error("coordinates must be an array of two or more positions");
287
- }
288
- var geom = {
289
- type: "LineString",
290
- coordinates: coordinates,
291
- };
292
- return feature(geom, properties, options);
293
- }
188
+ declare function lineString<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
189
+ bbox?: BBox;
190
+ id?: Id;
191
+ }): Feature<LineString, P>;
294
192
  /**
295
193
  * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.
296
194
  *
@@ -310,12 +208,10 @@ export function lineString(coordinates, properties, options) {
310
208
  *
311
209
  * //=linestrings
312
210
  */
313
- export function lineStrings(coordinates, properties, options) {
314
- if (options === void 0) { options = {}; }
315
- return featureCollection(coordinates.map(function (coords) {
316
- return lineString(coords, properties);
317
- }), options);
318
- }
211
+ declare function lineStrings<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
212
+ bbox?: BBox;
213
+ id?: Id;
214
+ }): FeatureCollection<LineString, P>;
319
215
  /**
320
216
  * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
321
217
  *
@@ -338,18 +234,10 @@ export function lineStrings(coordinates, properties, options) {
338
234
  *
339
235
  * //=collection
340
236
  */
341
- export function featureCollection(features, options) {
342
- if (options === void 0) { options = {}; }
343
- var fc = { type: "FeatureCollection" };
344
- if (options.id) {
345
- fc.id = options.id;
346
- }
347
- if (options.bbox) {
348
- fc.bbox = options.bbox;
349
- }
350
- fc.features = features;
351
- return fc;
352
- }
237
+ declare function featureCollection<G extends GeometryObject = Geometry, P extends GeoJsonProperties = GeoJsonProperties>(features: Array<Feature<G, P>>, options?: {
238
+ bbox?: BBox;
239
+ id?: Id;
240
+ }): FeatureCollection<G, P>;
353
241
  /**
354
242
  * Creates a {@link Feature<MultiLineString>} based on a
355
243
  * coordinate array. Properties can be added optionally.
@@ -367,14 +255,10 @@ export function featureCollection(features, options) {
367
255
  *
368
256
  * //=multiLine
369
257
  */
370
- export function multiLineString(coordinates, properties, options) {
371
- if (options === void 0) { options = {}; }
372
- var geom = {
373
- type: "MultiLineString",
374
- coordinates: coordinates,
375
- };
376
- return feature(geom, properties, options);
377
- }
258
+ declare function multiLineString<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
259
+ bbox?: BBox;
260
+ id?: Id;
261
+ }): Feature<MultiLineString, P>;
378
262
  /**
379
263
  * Creates a {@link Feature<MultiPoint>} based on a
380
264
  * coordinate array. Properties can be added optionally.
@@ -392,14 +276,10 @@ export function multiLineString(coordinates, properties, options) {
392
276
  *
393
277
  * //=multiPt
394
278
  */
395
- export function multiPoint(coordinates, properties, options) {
396
- if (options === void 0) { options = {}; }
397
- var geom = {
398
- type: "MultiPoint",
399
- coordinates: coordinates,
400
- };
401
- return feature(geom, properties, options);
402
- }
279
+ declare function multiPoint<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
280
+ bbox?: BBox;
281
+ id?: Id;
282
+ }): Feature<MultiPoint, P>;
403
283
  /**
404
284
  * Creates a {@link Feature<MultiPolygon>} based on a
405
285
  * coordinate array. Properties can be added optionally.
@@ -418,14 +298,10 @@ export function multiPoint(coordinates, properties, options) {
418
298
  * //=multiPoly
419
299
  *
420
300
  */
421
- export function multiPolygon(coordinates, properties, options) {
422
- if (options === void 0) { options = {}; }
423
- var geom = {
424
- type: "MultiPolygon",
425
- coordinates: coordinates,
426
- };
427
- return feature(geom, properties, options);
428
- }
301
+ declare function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(coordinates: Position[][][], properties?: P, options?: {
302
+ bbox?: BBox;
303
+ id?: Id;
304
+ }): Feature<MultiPolygon, P>;
429
305
  /**
430
306
  * Creates a {@link Feature<GeometryCollection>} based on a
431
307
  * coordinate array. Properties can be added optionally.
@@ -444,14 +320,10 @@ export function multiPolygon(coordinates, properties, options) {
444
320
  *
445
321
  * // => collection
446
322
  */
447
- export function geometryCollection(geometries, properties, options) {
448
- if (options === void 0) { options = {}; }
449
- var geom = {
450
- type: "GeometryCollection",
451
- geometries: geometries,
452
- };
453
- return feature(geom, properties, options);
454
- }
323
+ declare function geometryCollection<P extends GeoJsonProperties = GeoJsonProperties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
324
+ bbox?: BBox;
325
+ id?: Id;
326
+ }): Feature<GeometryCollection, P>;
455
327
  /**
456
328
  * Round number to precision
457
329
  *
@@ -465,14 +337,7 @@ export function geometryCollection(geometries, properties, options) {
465
337
  * turf.round(120.4321, 2)
466
338
  * //=120.43
467
339
  */
468
- export function round(num, precision) {
469
- if (precision === void 0) { precision = 0; }
470
- if (precision && !(precision >= 0)) {
471
- throw new Error("precision must be a positive number");
472
- }
473
- var multiplier = Math.pow(10, precision || 0);
474
- return Math.round(num * multiplier) / multiplier;
475
- }
340
+ declare function round(num: number, precision?: number): number;
476
341
  /**
477
342
  * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.
478
343
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
@@ -483,14 +348,7 @@ export function round(num, precision) {
483
348
  * meters, kilometres, kilometers.
484
349
  * @returns {number} distance
485
350
  */
486
- export function radiansToLength(radians, units) {
487
- if (units === void 0) { units = "kilometers"; }
488
- var factor = factors[units];
489
- if (!factor) {
490
- throw new Error(units + " units is invalid");
491
- }
492
- return radians * factor;
493
- }
351
+ declare function radiansToLength(radians: number, units?: Units): number;
494
352
  /**
495
353
  * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians
496
354
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
@@ -501,14 +359,7 @@ export function radiansToLength(radians, units) {
501
359
  * meters, kilometres, kilometers.
502
360
  * @returns {number} radians
503
361
  */
504
- export function lengthToRadians(distance, units) {
505
- if (units === void 0) { units = "kilometers"; }
506
- var factor = factors[units];
507
- if (!factor) {
508
- throw new Error(units + " units is invalid");
509
- }
510
- return distance / factor;
511
- }
362
+ declare function lengthToRadians(distance: number, units?: Units): number;
512
363
  /**
513
364
  * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees
514
365
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet
@@ -519,9 +370,7 @@ export function lengthToRadians(distance, units) {
519
370
  * meters, kilometres, kilometers.
520
371
  * @returns {number} degrees
521
372
  */
522
- export function lengthToDegrees(distance, units) {
523
- return radiansToDegrees(lengthToRadians(distance, units));
524
- }
373
+ declare function lengthToDegrees(distance: number, units?: Units): number;
525
374
  /**
526
375
  * Converts any bearing angle from the north line direction (positive clockwise)
527
376
  * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line
@@ -530,13 +379,16 @@ export function lengthToDegrees(distance, units) {
530
379
  * @param {number} bearing angle, between -180 and +180 degrees
531
380
  * @returns {number} angle between 0 and 360 degrees
532
381
  */
533
- export function bearingToAzimuth(bearing) {
534
- var angle = bearing % 360;
535
- if (angle < 0) {
536
- angle += 360;
537
- }
538
- return angle;
539
- }
382
+ declare function bearingToAzimuth(bearing: number): number;
383
+ /**
384
+ * Converts any azimuth angle from the north line direction (positive clockwise)
385
+ * and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line
386
+ *
387
+ * @name azimuthToBearing
388
+ * @param {number} angle between 0 and 360 degrees
389
+ * @returns {number} bearing between -180 and +180 degrees
390
+ */
391
+ declare function azimuthToBearing(angle: number): number;
540
392
  /**
541
393
  * Converts an angle in radians to degrees
542
394
  *
@@ -544,10 +396,7 @@ export function bearingToAzimuth(bearing) {
544
396
  * @param {number} radians angle in radians
545
397
  * @returns {number} degrees between 0 and 360 degrees
546
398
  */
547
- export function radiansToDegrees(radians) {
548
- var degrees = radians % (2 * Math.PI);
549
- return (degrees * 180) / Math.PI;
550
- }
399
+ declare function radiansToDegrees(radians: number): number;
551
400
  /**
552
401
  * Converts an angle in degrees to radians
553
402
  *
@@ -555,10 +404,7 @@ export function radiansToDegrees(radians) {
555
404
  * @param {number} degrees angle between 0 and 360 degrees
556
405
  * @returns {number} angle in radians
557
406
  */
558
- export function degreesToRadians(degrees) {
559
- var radians = degrees % 360;
560
- return (radians * Math.PI) / 180;
561
- }
407
+ declare function degreesToRadians(degrees: number): number;
562
408
  /**
563
409
  * Converts a length to the requested unit.
564
410
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
@@ -568,14 +414,7 @@ export function degreesToRadians(degrees) {
568
414
  * @param {Units} [finalUnit="kilometers"] returned unit
569
415
  * @returns {number} the converted length
570
416
  */
571
- export function convertLength(length, originalUnit, finalUnit) {
572
- if (originalUnit === void 0) { originalUnit = "kilometers"; }
573
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
574
- if (!(length >= 0)) {
575
- throw new Error("length must be a positive number");
576
- }
577
- return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
578
- }
417
+ declare function convertLength(length: number, originalUnit?: Units, finalUnit?: Units): number;
579
418
  /**
580
419
  * Converts a area to the requested unit.
581
420
  * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares
@@ -584,22 +423,7 @@ export function convertLength(length, originalUnit, finalUnit) {
584
423
  * @param {Units} [finalUnit="kilometers"] returned unit
585
424
  * @returns {number} the converted area
586
425
  */
587
- export function convertArea(area, originalUnit, finalUnit) {
588
- if (originalUnit === void 0) { originalUnit = "meters"; }
589
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
590
- if (!(area >= 0)) {
591
- throw new Error("area must be a positive number");
592
- }
593
- var startFactor = areaFactors[originalUnit];
594
- if (!startFactor) {
595
- throw new Error("invalid original units");
596
- }
597
- var finalFactor = areaFactors[finalUnit];
598
- if (!finalFactor) {
599
- throw new Error("invalid final units");
600
- }
601
- return (area / startFactor) * finalFactor;
602
- }
426
+ declare function convertArea(area: number, originalUnit?: AreaUnits, finalUnit?: AreaUnits): number;
603
427
  /**
604
428
  * isNumber
605
429
  *
@@ -611,30 +435,26 @@ export function convertArea(area, originalUnit, finalUnit) {
611
435
  * turf.isNumber('foo')
612
436
  * //=false
613
437
  */
614
- export function isNumber(num) {
615
- return !isNaN(num) && num !== null && !Array.isArray(num);
616
- }
438
+ declare function isNumber(num: any): boolean;
617
439
  /**
618
440
  * isObject
619
441
  *
620
442
  * @param {*} input variable to validate
621
- * @returns {boolean} true/false
443
+ * @returns {boolean} true/false, including false for Arrays and Functions
622
444
  * @example
623
445
  * turf.isObject({elevation: 10})
624
446
  * //=true
625
447
  * turf.isObject('foo')
626
448
  * //=false
627
449
  */
628
- export function isObject(input) {
629
- return !!input && input.constructor === Object;
630
- }
450
+ declare function isObject(input: any): boolean;
631
451
  /**
632
452
  * Validate BBox
633
453
  *
634
454
  * @private
635
455
  * @param {Array<number>} bbox BBox to validate
636
456
  * @returns {void}
637
- * @throws Error if BBox is not valid
457
+ * @throws {Error} if BBox is not valid
638
458
  * @example
639
459
  * validateBBox([-180, -40, 110, 50])
640
460
  * //=OK
@@ -649,29 +469,14 @@ export function isObject(input) {
649
469
  * validateBBox(undefined)
650
470
  * //=Error
651
471
  */
652
- export function validateBBox(bbox) {
653
- if (!bbox) {
654
- throw new Error("bbox is required");
655
- }
656
- if (!Array.isArray(bbox)) {
657
- throw new Error("bbox must be an Array");
658
- }
659
- if (bbox.length !== 4 && bbox.length !== 6) {
660
- throw new Error("bbox must be an Array of 4 or 6 numbers");
661
- }
662
- bbox.forEach(function (num) {
663
- if (!isNumber(num)) {
664
- throw new Error("bbox must only contain numbers");
665
- }
666
- });
667
- }
472
+ declare function validateBBox(bbox: any): void;
668
473
  /**
669
474
  * Validate Id
670
475
  *
671
476
  * @private
672
477
  * @param {string|number} id Id to validate
673
478
  * @returns {void}
674
- * @throws Error if Id is not valid
479
+ * @throws {Error} if Id is not valid
675
480
  * @example
676
481
  * validateId([-180, -40, 110, 50])
677
482
  * //=Error
@@ -686,11 +491,6 @@ export function validateBBox(bbox) {
686
491
  * validateId(undefined)
687
492
  * //=Error
688
493
  */
689
- export function validateId(id) {
690
- if (!id) {
691
- throw new Error("id is required");
692
- }
693
- if (["string", "number"].indexOf(typeof id) === -1) {
694
- throw new Error("id must be a number or a string");
695
- }
696
- }
494
+ declare function validateId(id: any): void;
495
+
496
+ export { type AllGeoJSON, type AreaUnits, type Coord, type Corners, type Grid, type Id, type Lines, type Units, areaFactors, azimuthToBearing, bearingToAzimuth, convertArea, convertLength, degreesToRadians, earthRadius, factors, feature, featureCollection, geometry, geometryCollection, isNumber, isObject, lengthToDegrees, lengthToRadians, lineString, lineStrings, multiLineString, multiPoint, multiPolygon, point, points, polygon, polygons, radiansToDegrees, radiansToLength, round, validateBBox, validateId };