@turf/helpers 7.1.0 → 7.3.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.
@@ -11,20 +11,57 @@ import { Feature, Point, Position, LineString, MultiLineString, Polygon, MultiPo
11
11
  */
12
12
  type Id = string | number;
13
13
 
14
+ /**
15
+ * @module helpers
16
+ */
14
17
  type Coord = Feature<Point> | Point | Position;
18
+ /**
19
+ * Linear measurement units.
20
+ *
21
+ * ⚠️ Warning. Be aware of the implications of using radian or degree units to
22
+ * measure distance. The distance represented by a degree of longitude *varies*
23
+ * depending on latitude.
24
+ *
25
+ * See https://www.thoughtco.com/degree-of-latitude-and-longitude-distance-4070616
26
+ * for an illustration of this behaviour.
27
+ *
28
+ * @typedef
29
+ */
15
30
  type Units = "meters" | "metres" | "millimeters" | "millimetres" | "centimeters" | "centimetres" | "kilometers" | "kilometres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees";
31
+ /**
32
+ * Area measurement units.
33
+ *
34
+ * @typedef
35
+ */
16
36
  type AreaUnits = Exclude<Units, "radians" | "degrees"> | "acres" | "hectares";
37
+ /**
38
+ * Grid types.
39
+ *
40
+ * @typedef
41
+ */
17
42
  type Grid = "point" | "square" | "hex" | "triangle";
43
+ /**
44
+ * Shorthand corner identifiers.
45
+ *
46
+ * @typedef
47
+ */
18
48
  type Corners = "sw" | "se" | "nw" | "ne" | "center" | "centroid";
49
+ /**
50
+ * Geometries made up of lines i.e. lines and polygons.
51
+ *
52
+ * @typedef
53
+ */
19
54
  type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
20
- type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
21
55
  /**
22
- * @module helpers
56
+ * Convenience type for all possible GeoJSON.
57
+ *
58
+ * @typedef
23
59
  */
60
+ type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
24
61
  /**
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.
26
- * @memberof helpers
27
- * @type {number}
62
+ * The Earth radius in meters. 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.
63
+ *
64
+ * @constant
28
65
  */
29
66
  declare const earthRadius = 6371008.8;
30
67
  /**
@@ -32,28 +69,26 @@ declare const earthRadius = 6371008.8;
32
69
  *
33
70
  * Keys are the name of the unit, values are the number of that unit in a single radian
34
71
  *
35
- * @memberof helpers
36
- * @type {Object}
72
+ * @constant
37
73
  */
38
74
  declare const factors: Record<Units, number>;
39
75
  /**
40
76
 
41
77
  * Area of measurement factors based on 1 square meter.
42
78
  *
43
- * @memberof helpers
44
- * @type {Object}
79
+ * @constant
45
80
  */
46
81
  declare const areaFactors: Record<AreaUnits, number>;
47
82
  /**
48
83
  * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
49
84
  *
50
- * @name feature
51
- * @param {Geometry} geometry input geometry
52
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
85
+ * @function
86
+ * @param {GeometryObject} geometry input geometry
87
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
53
88
  * @param {Object} [options={}] Optional Parameters
54
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
55
- * @param {string|number} [options.id] Identifier associated with the Feature
56
- * @returns {Feature} a GeoJSON Feature
89
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
90
+ * @param {Id} [options.id] Identifier associated with the Feature
91
+ * @returns {Feature<GeometryObject, GeoJsonProperties>} a GeoJSON Feature
57
92
  * @example
58
93
  * var geometry = {
59
94
  * "type": "Point",
@@ -72,8 +107,8 @@ declare function feature<G extends GeometryObject = Geometry, P extends GeoJsonP
72
107
  * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.
73
108
  * For GeometryCollection type use `helpers.geometryCollection`
74
109
  *
75
- * @name geometry
76
- * @param {string} type Geometry Type
110
+ * @function
111
+ * @param {("Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon")} type Geometry Type
77
112
  * @param {Array<any>} coordinates Coordinates
78
113
  * @param {Object} [options={}] Optional Parameters
79
114
  * @returns {Geometry} a GeoJSON Geometry
@@ -87,13 +122,13 @@ declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint
87
122
  /**
88
123
  * Creates a {@link Point} {@link Feature} from a Position.
89
124
  *
90
- * @name point
91
- * @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)
92
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
125
+ * @function
126
+ * @param {Position} coordinates longitude, latitude position (each in decimal degrees)
127
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
93
128
  * @param {Object} [options={}] Optional Parameters
94
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
95
- * @param {string|number} [options.id] Identifier associated with the Feature
96
- * @returns {Feature<Point>} a Point feature
129
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
130
+ * @param {Id} [options.id] Identifier associated with the Feature
131
+ * @returns {Feature<Point, GeoJsonProperties>} a Point feature
97
132
  * @example
98
133
  * var point = turf.point([-75.343, 39.984]);
99
134
  *
@@ -106,13 +141,13 @@ declare function point<P extends GeoJsonProperties = GeoJsonProperties>(coordina
106
141
  /**
107
142
  * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.
108
143
  *
109
- * @name points
110
- * @param {Array<Array<number>>} coordinates an array of Points
111
- * @param {Object} [properties={}] Translate these properties to each Feature
144
+ * @function
145
+ * @param {Position[]} coordinates an array of Points
146
+ * @param {GeoJsonProperties} [properties={}] Translate these properties to each Feature
112
147
  * @param {Object} [options={}] Optional Parameters
113
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
148
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]
114
149
  * associated with the FeatureCollection
115
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
150
+ * @param {Id} [options.id] Identifier associated with the FeatureCollection
116
151
  * @returns {FeatureCollection<Point>} Point Feature
117
152
  * @example
118
153
  * var points = turf.points([
@@ -130,13 +165,13 @@ declare function points<P extends GeoJsonProperties = GeoJsonProperties>(coordin
130
165
  /**
131
166
  * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.
132
167
  *
133
- * @name polygon
134
- * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
135
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
168
+ * @function
169
+ * @param {Position[][]} coordinates an array of LinearRings
170
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
136
171
  * @param {Object} [options={}] Optional Parameters
137
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
138
- * @param {string|number} [options.id] Identifier associated with the Feature
139
- * @returns {Feature<Polygon>} Polygon Feature
172
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
173
+ * @param {Id} [options.id] Identifier associated with the Feature
174
+ * @returns {Feature<Polygon, GeoJsonProperties>} Polygon Feature
140
175
  * @example
141
176
  * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });
142
177
  *
@@ -149,13 +184,13 @@ declare function polygon<P extends GeoJsonProperties = GeoJsonProperties>(coordi
149
184
  /**
150
185
  * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.
151
186
  *
152
- * @name polygons
153
- * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates
154
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
187
+ * @function
188
+ * @param {Position[][][]} coordinates an array of Polygon coordinates
189
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
155
190
  * @param {Object} [options={}] Optional Parameters
156
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
157
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
158
- * @returns {FeatureCollection<Polygon>} Polygon FeatureCollection
191
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
192
+ * @param {Id} [options.id] Identifier associated with the FeatureCollection
193
+ * @returns {FeatureCollection<Polygon, GeoJsonProperties>} Polygon FeatureCollection
159
194
  * @example
160
195
  * var polygons = turf.polygons([
161
196
  * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],
@@ -171,13 +206,13 @@ declare function polygons<P extends GeoJsonProperties = GeoJsonProperties>(coord
171
206
  /**
172
207
  * Creates a {@link LineString} {@link Feature} from an Array of Positions.
173
208
  *
174
- * @name lineString
175
- * @param {Array<Array<number>>} coordinates an array of Positions
176
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
209
+ * @function
210
+ * @param {Position[]} coordinates an array of Positions
211
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
177
212
  * @param {Object} [options={}] Optional Parameters
178
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
179
- * @param {string|number} [options.id] Identifier associated with the Feature
180
- * @returns {Feature<LineString>} LineString Feature
213
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
214
+ * @param {Id} [options.id] Identifier associated with the Feature
215
+ * @returns {Feature<LineString, GeoJsonProperties>} LineString Feature
181
216
  * @example
182
217
  * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});
183
218
  * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});
@@ -192,14 +227,14 @@ declare function lineString<P extends GeoJsonProperties = GeoJsonProperties>(coo
192
227
  /**
193
228
  * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.
194
229
  *
195
- * @name lineStrings
196
- * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
197
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
230
+ * @function
231
+ * @param {Position[][]} coordinates an array of LinearRings
232
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
198
233
  * @param {Object} [options={}] Optional Parameters
199
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
234
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north]
200
235
  * associated with the FeatureCollection
201
- * @param {string|number} [options.id] Identifier associated with the FeatureCollection
202
- * @returns {FeatureCollection<LineString>} LineString FeatureCollection
236
+ * @param {Id} [options.id] Identifier associated with the FeatureCollection
237
+ * @returns {FeatureCollection<LineString, GeoJsonProperties>} LineString FeatureCollection
203
238
  * @example
204
239
  * var linestrings = turf.lineStrings([
205
240
  * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],
@@ -215,12 +250,12 @@ declare function lineStrings<P extends GeoJsonProperties = GeoJsonProperties>(co
215
250
  /**
216
251
  * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
217
252
  *
218
- * @name featureCollection
219
- * @param {Feature[]} features input features
253
+ * @function
254
+ * @param {Array<Feature<GeometryObject, GeoJsonProperties>>} features input features
220
255
  * @param {Object} [options={}] Optional Parameters
221
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
222
- * @param {string|number} [options.id] Identifier associated with the Feature
223
- * @returns {FeatureCollection} FeatureCollection of Features
256
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
257
+ * @param {Id} [options.id] Identifier associated with the Feature
258
+ * @returns {FeatureCollection<GeometryObject, GeoJsonProperties>} FeatureCollection of Features
224
259
  * @example
225
260
  * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});
226
261
  * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});
@@ -239,16 +274,16 @@ declare function featureCollection<G extends GeometryObject = Geometry, P extend
239
274
  id?: Id;
240
275
  }): FeatureCollection<G, P>;
241
276
  /**
242
- * Creates a {@link Feature<MultiLineString>} based on a
277
+ * Creates a {@link Feature}<{@link MultiLineString}> based on a
243
278
  * coordinate array. Properties can be added optionally.
244
279
  *
245
- * @name multiLineString
246
- * @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
247
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
280
+ * @function
281
+ * @param {Position[][]} coordinates an array of LineStrings
282
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
248
283
  * @param {Object} [options={}] Optional Parameters
249
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
250
- * @param {string|number} [options.id] Identifier associated with the Feature
251
- * @returns {Feature<MultiLineString>} a MultiLineString feature
284
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
285
+ * @param {Id} [options.id] Identifier associated with the Feature
286
+ * @returns {Feature<MultiLineString, GeoJsonProperties>} a MultiLineString feature
252
287
  * @throws {Error} if no coordinates are passed
253
288
  * @example
254
289
  * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
@@ -260,16 +295,16 @@ declare function multiLineString<P extends GeoJsonProperties = GeoJsonProperties
260
295
  id?: Id;
261
296
  }): Feature<MultiLineString, P>;
262
297
  /**
263
- * Creates a {@link Feature<MultiPoint>} based on a
298
+ * Creates a {@link Feature}<{@link MultiPoint}> based on a
264
299
  * coordinate array. Properties can be added optionally.
265
300
  *
266
- * @name multiPoint
267
- * @param {Array<Array<number>>} coordinates an array of Positions
268
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
301
+ * @function
302
+ * @param {Position[]} coordinates an array of Positions
303
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
269
304
  * @param {Object} [options={}] Optional Parameters
270
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
271
- * @param {string|number} [options.id] Identifier associated with the Feature
272
- * @returns {Feature<MultiPoint>} a MultiPoint feature
305
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
306
+ * @param {Id} [options.id] Identifier associated with the Feature
307
+ * @returns {Feature<MultiPoint, GeoJsonProperties>} a MultiPoint feature
273
308
  * @throws {Error} if no coordinates are passed
274
309
  * @example
275
310
  * var multiPt = turf.multiPoint([[0,0],[10,10]]);
@@ -281,16 +316,16 @@ declare function multiPoint<P extends GeoJsonProperties = GeoJsonProperties>(coo
281
316
  id?: Id;
282
317
  }): Feature<MultiPoint, P>;
283
318
  /**
284
- * Creates a {@link Feature<MultiPolygon>} based on a
319
+ * Creates a {@link Feature}<{@link MultiPolygon}> based on a
285
320
  * coordinate array. Properties can be added optionally.
286
321
  *
287
- * @name multiPolygon
288
- * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons
289
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
322
+ * @function
323
+ * @param {Position[][][]} coordinates an array of Polygons
324
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
290
325
  * @param {Object} [options={}] Optional Parameters
291
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
292
- * @param {string|number} [options.id] Identifier associated with the Feature
293
- * @returns {Feature<MultiPolygon>} a multipolygon feature
326
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
327
+ * @param {Id} [options.id] Identifier associated with the Feature
328
+ * @returns {Feature<MultiPolygon, GeoJsonProperties>} a multipolygon feature
294
329
  * @throws {Error} if no coordinates are passed
295
330
  * @example
296
331
  * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
@@ -303,16 +338,16 @@ declare function multiPolygon<P extends GeoJsonProperties = GeoJsonProperties>(c
303
338
  id?: Id;
304
339
  }): Feature<MultiPolygon, P>;
305
340
  /**
306
- * Creates a {@link Feature<GeometryCollection>} based on a
341
+ * Creates a Feature<GeometryCollection> based on a
307
342
  * coordinate array. Properties can be added optionally.
308
343
  *
309
- * @name geometryCollection
310
- * @param {Array<Geometry>} geometries an array of GeoJSON Geometries
311
- * @param {Object} [properties={}] an Object of key-value pairs to add as properties
344
+ * @function
345
+ * @param {Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>} geometries an array of GeoJSON Geometries
346
+ * @param {GeoJsonProperties} [properties={}] an Object of key-value pairs to add as properties
312
347
  * @param {Object} [options={}] Optional Parameters
313
- * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
314
- * @param {string|number} [options.id] Identifier associated with the Feature
315
- * @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature
348
+ * @param {BBox} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
349
+ * @param {Id} [options.id] Identifier associated with the Feature
350
+ * @returns {Feature<GeometryCollection, GeoJsonProperties>} a GeoJSON GeometryCollection Feature
316
351
  * @example
317
352
  * var pt = turf.geometry("Point", [100, 0]);
318
353
  * var line = turf.geometry("LineString", [[101, 0], [102, 1]]);
@@ -327,6 +362,7 @@ declare function geometryCollection<P extends GeoJsonProperties = GeoJsonPropert
327
362
  /**
328
363
  * Round number to precision
329
364
  *
365
+ * @function
330
366
  * @param {number} num Number
331
367
  * @param {number} [precision=0] Precision
332
368
  * @returns {number} rounded number
@@ -342,9 +378,9 @@ declare function round(num: number, precision?: number): number;
342
378
  * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.
343
379
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
344
380
  *
345
- * @name radiansToLength
381
+ * @function
346
382
  * @param {number} radians in radians across the sphere
347
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
383
+ * @param {Units} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
348
384
  * meters, kilometres, kilometers.
349
385
  * @returns {number} distance
350
386
  */
@@ -353,9 +389,9 @@ declare function radiansToLength(radians: number, units?: Units): number;
353
389
  * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians
354
390
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
355
391
  *
356
- * @name lengthToRadians
392
+ * @function
357
393
  * @param {number} distance in real units
358
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
394
+ * @param {Units} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
359
395
  * meters, kilometres, kilometers.
360
396
  * @returns {number} radians
361
397
  */
@@ -364,9 +400,9 @@ declare function lengthToRadians(distance: number, units?: Units): number;
364
400
  * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees
365
401
  * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet
366
402
  *
367
- * @name lengthToDegrees
403
+ * @function
368
404
  * @param {number} distance in real units
369
- * @param {string} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
405
+ * @param {Units} [units="kilometers"] can be degrees, radians, miles, inches, yards, metres,
370
406
  * meters, kilometres, kilometers.
371
407
  * @returns {number} degrees
372
408
  */
@@ -375,7 +411,7 @@ declare function lengthToDegrees(distance: number, units?: Units): number;
375
411
  * Converts any bearing angle from the north line direction (positive clockwise)
376
412
  * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line
377
413
  *
378
- * @name bearingToAzimuth
414
+ * @function
379
415
  * @param {number} bearing angle, between -180 and +180 degrees
380
416
  * @returns {number} angle between 0 and 360 degrees
381
417
  */
@@ -384,7 +420,7 @@ declare function bearingToAzimuth(bearing: number): number;
384
420
  * Converts any azimuth angle from the north line direction (positive clockwise)
385
421
  * and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line
386
422
  *
387
- * @name azimuthToBearing
423
+ * @function
388
424
  * @param {number} angle between 0 and 360 degrees
389
425
  * @returns {number} bearing between -180 and +180 degrees
390
426
  */
@@ -392,7 +428,7 @@ declare function azimuthToBearing(angle: number): number;
392
428
  /**
393
429
  * Converts an angle in radians to degrees
394
430
  *
395
- * @name radiansToDegrees
431
+ * @function
396
432
  * @param {number} radians angle in radians
397
433
  * @returns {number} degrees between 0 and 360 degrees
398
434
  */
@@ -400,34 +436,36 @@ declare function radiansToDegrees(radians: number): number;
400
436
  /**
401
437
  * Converts an angle in degrees to radians
402
438
  *
403
- * @name degreesToRadians
439
+ * @function
404
440
  * @param {number} degrees angle between 0 and 360 degrees
405
441
  * @returns {number} angle in radians
406
442
  */
407
443
  declare function degreesToRadians(degrees: number): number;
408
444
  /**
409
- * Converts a length to the requested unit.
410
- * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
445
+ * Converts a length from one unit to another.
411
446
  *
412
- * @param {number} length to be converted
413
- * @param {Units} [originalUnit="kilometers"] of the length
414
- * @param {Units} [finalUnit="kilometers"] returned unit
415
- * @returns {number} the converted length
447
+ * @function
448
+ * @param {number} length Length to be converted
449
+ * @param {Units} [originalUnit="kilometers"] Input length unit
450
+ * @param {Units} [finalUnit="kilometers"] Returned length unit
451
+ * @returns {number} The converted length
416
452
  */
417
453
  declare function convertLength(length: number, originalUnit?: Units, finalUnit?: Units): number;
418
454
  /**
419
- * Converts a area to the requested unit.
420
- * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares
421
- * @param {number} area to be converted
422
- * @param {Units} [originalUnit="meters"] of the distance
423
- * @param {Units} [finalUnit="kilometers"] returned unit
424
- * @returns {number} the converted area
455
+ * Converts an area from one unit to another.
456
+ *
457
+ * @function
458
+ * @param {number} area Area to be converted
459
+ * @param {AreaUnits} [originalUnit="meters"] Input area unit
460
+ * @param {AreaUnits} [finalUnit="kilometers"] Returned area unit
461
+ * @returns {number} The converted length
425
462
  */
426
463
  declare function convertArea(area: number, originalUnit?: AreaUnits, finalUnit?: AreaUnits): number;
427
464
  /**
428
465
  * isNumber
429
466
  *
430
- * @param {*} num Number to validate
467
+ * @function
468
+ * @param {any} num Number to validate
431
469
  * @returns {boolean} true/false
432
470
  * @example
433
471
  * turf.isNumber(123)
@@ -439,7 +477,8 @@ declare function isNumber(num: any): boolean;
439
477
  /**
440
478
  * isObject
441
479
  *
442
- * @param {*} input variable to validate
480
+ * @function
481
+ * @param {any} input variable to validate
443
482
  * @returns {boolean} true/false, including false for Arrays and Functions
444
483
  * @example
445
484
  * turf.isObject({elevation: 10})
@@ -452,7 +491,7 @@ declare function isObject(input: any): boolean;
452
491
  * Validate BBox
453
492
  *
454
493
  * @private
455
- * @param {Array<number>} bbox BBox to validate
494
+ * @param {any} bbox BBox to validate
456
495
  * @returns {void}
457
496
  * @throws {Error} if BBox is not valid
458
497
  * @example
@@ -474,7 +513,7 @@ declare function validateBBox(bbox: any): void;
474
513
  * Validate Id
475
514
  *
476
515
  * @private
477
- * @param {string|number} id Id to validate
516
+ * @param {any} id Id to validate
478
517
  * @returns {void}
479
518
  * @throws {Error} if Id is not valid
480
519
  * @example