@turf/helpers 6.5.0 → 7.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -7,17 +7,19 @@
7
7
  * @memberof helpers
8
8
  * @type {number}
9
9
  */
10
- export var earthRadius = 6371008.8;
10
+ export const earthRadius = 6371008.8;
11
11
  /**
12
12
  * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
13
13
  *
14
+ * Keys are the name of the unit, values are the number of that unit in a single radian
15
+ *
14
16
  * @memberof helpers
15
17
  * @type {Object}
16
18
  */
17
- export var factors = {
19
+ export const factors = {
18
20
  centimeters: earthRadius * 100,
19
21
  centimetres: earthRadius * 100,
20
- degrees: earthRadius / 111325,
22
+ degrees: 360 / (2 * Math.PI),
21
23
  feet: earthRadius * 3.28084,
22
24
  inches: earthRadius * 39.37,
23
25
  kilometers: earthRadius / 1000,
@@ -32,35 +34,13 @@ export var factors = {
32
34
  yards: earthRadius * 1.0936,
33
35
  };
34
36
  /**
35
- * Units of measurement factors based on 1 meter.
36
- *
37
- * @memberof helpers
38
- * @type {Object}
39
- */
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
- };
57
- /**
37
+
58
38
  * Area of measurement factors based on 1 square meter.
59
39
  *
60
40
  * @memberof helpers
61
41
  * @type {Object}
62
42
  */
63
- export var areaFactors = {
43
+ export const areaFactors = {
64
44
  acres: 0.000247105,
65
45
  centimeters: 10000,
66
46
  centimetres: 10000,
@@ -72,6 +52,7 @@ export var areaFactors = {
72
52
  meters: 1,
73
53
  metres: 1,
74
54
  miles: 3.86e-7,
55
+ nauticalmiles: 2.9155334959812285e-7,
75
56
  millimeters: 1000000,
76
57
  millimetres: 1000000,
77
58
  yards: 1.195990046,
@@ -96,9 +77,8 @@ export var areaFactors = {
96
77
  *
97
78
  * //=feature
98
79
  */
99
- export function feature(geom, properties, options) {
100
- if (options === void 0) { options = {}; }
101
- var feat = { type: "Feature" };
80
+ export function feature(geom, properties, options = {}) {
81
+ const feat = { type: "Feature" };
102
82
  if (options.id === 0 || options.id) {
103
83
  feat.id = options.id;
104
84
  }
@@ -124,8 +104,7 @@ export function feature(geom, properties, options) {
124
104
  * var geometry = turf.geometry(type, coordinates);
125
105
  * // => geometry
126
106
  */
127
- export function geometry(type, coordinates, _options) {
128
- if (_options === void 0) { _options = {}; }
107
+ export function geometry(type, coordinates, _options = {}) {
129
108
  switch (type) {
130
109
  case "Point":
131
110
  return point(coordinates).geometry;
@@ -158,8 +137,7 @@ export function geometry(type, coordinates, _options) {
158
137
  *
159
138
  * //=point
160
139
  */
161
- export function point(coordinates, properties, options) {
162
- if (options === void 0) { options = {}; }
140
+ export function point(coordinates, properties, options = {}) {
163
141
  if (!coordinates) {
164
142
  throw new Error("coordinates is required");
165
143
  }
@@ -172,9 +150,9 @@ export function point(coordinates, properties, options) {
172
150
  if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {
173
151
  throw new Error("coordinates must contain numbers");
174
152
  }
175
- var geom = {
153
+ const geom = {
176
154
  type: "Point",
177
- coordinates: coordinates,
155
+ coordinates,
178
156
  };
179
157
  return feature(geom, properties, options);
180
158
  }
@@ -198,9 +176,8 @@ export function point(coordinates, properties, options) {
198
176
  *
199
177
  * //=points
200
178
  */
201
- export function points(coordinates, properties, options) {
202
- if (options === void 0) { options = {}; }
203
- return featureCollection(coordinates.map(function (coords) {
179
+ export function points(coordinates, properties, options = {}) {
180
+ return featureCollection(coordinates.map((coords) => {
204
181
  return point(coords, properties);
205
182
  }), options);
206
183
  }
@@ -219,23 +196,24 @@ export function points(coordinates, properties, options) {
219
196
  *
220
197
  * //=polygon
221
198
  */
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];
199
+ export function polygon(coordinates, properties, options = {}) {
200
+ for (const ring of coordinates) {
226
201
  if (ring.length < 4) {
227
202
  throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
228
203
  }
229
- for (var j = 0; j < ring[ring.length - 1].length; j++) {
204
+ if (ring[ring.length - 1].length !== ring[0].length) {
205
+ throw new Error("First and last Position are not equivalent.");
206
+ }
207
+ for (let j = 0; j < ring[ring.length - 1].length; j++) {
230
208
  // Check if first point of Polygon contains two numbers
231
209
  if (ring[ring.length - 1][j] !== ring[0][j]) {
232
210
  throw new Error("First and last Position are not equivalent.");
233
211
  }
234
212
  }
235
213
  }
236
- var geom = {
214
+ const geom = {
237
215
  type: "Polygon",
238
- coordinates: coordinates,
216
+ coordinates,
239
217
  };
240
218
  return feature(geom, properties, options);
241
219
  }
@@ -257,9 +235,8 @@ export function polygon(coordinates, properties, options) {
257
235
  *
258
236
  * //=polygons
259
237
  */
260
- export function polygons(coordinates, properties, options) {
261
- if (options === void 0) { options = {}; }
262
- return featureCollection(coordinates.map(function (coords) {
238
+ export function polygons(coordinates, properties, options = {}) {
239
+ return featureCollection(coordinates.map((coords) => {
263
240
  return polygon(coords, properties);
264
241
  }), options);
265
242
  }
@@ -280,14 +257,13 @@ export function polygons(coordinates, properties, options) {
280
257
  * //=linestring1
281
258
  * //=linestring2
282
259
  */
283
- export function lineString(coordinates, properties, options) {
284
- if (options === void 0) { options = {}; }
260
+ export function lineString(coordinates, properties, options = {}) {
285
261
  if (coordinates.length < 2) {
286
262
  throw new Error("coordinates must be an array of two or more positions");
287
263
  }
288
- var geom = {
264
+ const geom = {
289
265
  type: "LineString",
290
- coordinates: coordinates,
266
+ coordinates,
291
267
  };
292
268
  return feature(geom, properties, options);
293
269
  }
@@ -310,9 +286,8 @@ export function lineString(coordinates, properties, options) {
310
286
  *
311
287
  * //=linestrings
312
288
  */
313
- export function lineStrings(coordinates, properties, options) {
314
- if (options === void 0) { options = {}; }
315
- return featureCollection(coordinates.map(function (coords) {
289
+ export function lineStrings(coordinates, properties, options = {}) {
290
+ return featureCollection(coordinates.map((coords) => {
316
291
  return lineString(coords, properties);
317
292
  }), options);
318
293
  }
@@ -338,9 +313,8 @@ export function lineStrings(coordinates, properties, options) {
338
313
  *
339
314
  * //=collection
340
315
  */
341
- export function featureCollection(features, options) {
342
- if (options === void 0) { options = {}; }
343
- var fc = { type: "FeatureCollection" };
316
+ export function featureCollection(features, options = {}) {
317
+ const fc = { type: "FeatureCollection" };
344
318
  if (options.id) {
345
319
  fc.id = options.id;
346
320
  }
@@ -367,11 +341,10 @@ export function featureCollection(features, options) {
367
341
  *
368
342
  * //=multiLine
369
343
  */
370
- export function multiLineString(coordinates, properties, options) {
371
- if (options === void 0) { options = {}; }
372
- var geom = {
344
+ export function multiLineString(coordinates, properties, options = {}) {
345
+ const geom = {
373
346
  type: "MultiLineString",
374
- coordinates: coordinates,
347
+ coordinates,
375
348
  };
376
349
  return feature(geom, properties, options);
377
350
  }
@@ -392,11 +365,10 @@ export function multiLineString(coordinates, properties, options) {
392
365
  *
393
366
  * //=multiPt
394
367
  */
395
- export function multiPoint(coordinates, properties, options) {
396
- if (options === void 0) { options = {}; }
397
- var geom = {
368
+ export function multiPoint(coordinates, properties, options = {}) {
369
+ const geom = {
398
370
  type: "MultiPoint",
399
- coordinates: coordinates,
371
+ coordinates,
400
372
  };
401
373
  return feature(geom, properties, options);
402
374
  }
@@ -418,11 +390,10 @@ export function multiPoint(coordinates, properties, options) {
418
390
  * //=multiPoly
419
391
  *
420
392
  */
421
- export function multiPolygon(coordinates, properties, options) {
422
- if (options === void 0) { options = {}; }
423
- var geom = {
393
+ export function multiPolygon(coordinates, properties, options = {}) {
394
+ const geom = {
424
395
  type: "MultiPolygon",
425
- coordinates: coordinates,
396
+ coordinates,
426
397
  };
427
398
  return feature(geom, properties, options);
428
399
  }
@@ -444,11 +415,10 @@ export function multiPolygon(coordinates, properties, options) {
444
415
  *
445
416
  * // => collection
446
417
  */
447
- export function geometryCollection(geometries, properties, options) {
448
- if (options === void 0) { options = {}; }
449
- var geom = {
418
+ export function geometryCollection(geometries, properties, options = {}) {
419
+ const geom = {
450
420
  type: "GeometryCollection",
451
- geometries: geometries,
421
+ geometries,
452
422
  };
453
423
  return feature(geom, properties, options);
454
424
  }
@@ -465,12 +435,11 @@ export function geometryCollection(geometries, properties, options) {
465
435
  * turf.round(120.4321, 2)
466
436
  * //=120.43
467
437
  */
468
- export function round(num, precision) {
469
- if (precision === void 0) { precision = 0; }
438
+ export function round(num, precision = 0) {
470
439
  if (precision && !(precision >= 0)) {
471
440
  throw new Error("precision must be a positive number");
472
441
  }
473
- var multiplier = Math.pow(10, precision || 0);
442
+ const multiplier = Math.pow(10, precision || 0);
474
443
  return Math.round(num * multiplier) / multiplier;
475
444
  }
476
445
  /**
@@ -483,9 +452,8 @@ export function round(num, precision) {
483
452
  * meters, kilometres, kilometers.
484
453
  * @returns {number} distance
485
454
  */
486
- export function radiansToLength(radians, units) {
487
- if (units === void 0) { units = "kilometers"; }
488
- var factor = factors[units];
455
+ export function radiansToLength(radians, units = "kilometers") {
456
+ const factor = factors[units];
489
457
  if (!factor) {
490
458
  throw new Error(units + " units is invalid");
491
459
  }
@@ -501,9 +469,8 @@ export function radiansToLength(radians, units) {
501
469
  * meters, kilometres, kilometers.
502
470
  * @returns {number} radians
503
471
  */
504
- export function lengthToRadians(distance, units) {
505
- if (units === void 0) { units = "kilometers"; }
506
- var factor = factors[units];
472
+ export function lengthToRadians(distance, units = "kilometers") {
473
+ const factor = factors[units];
507
474
  if (!factor) {
508
475
  throw new Error(units + " units is invalid");
509
476
  }
@@ -531,7 +498,7 @@ export function lengthToDegrees(distance, units) {
531
498
  * @returns {number} angle between 0 and 360 degrees
532
499
  */
533
500
  export function bearingToAzimuth(bearing) {
534
- var angle = bearing % 360;
501
+ let angle = bearing % 360;
535
502
  if (angle < 0) {
536
503
  angle += 360;
537
504
  }
@@ -545,7 +512,7 @@ export function bearingToAzimuth(bearing) {
545
512
  * @returns {number} degrees between 0 and 360 degrees
546
513
  */
547
514
  export function radiansToDegrees(radians) {
548
- var degrees = radians % (2 * Math.PI);
515
+ const degrees = radians % (2 * Math.PI);
549
516
  return (degrees * 180) / Math.PI;
550
517
  }
551
518
  /**
@@ -556,7 +523,7 @@ export function radiansToDegrees(radians) {
556
523
  * @returns {number} angle in radians
557
524
  */
558
525
  export function degreesToRadians(degrees) {
559
- var radians = degrees % 360;
526
+ const radians = degrees % 360;
560
527
  return (radians * Math.PI) / 180;
561
528
  }
562
529
  /**
@@ -568,9 +535,7 @@ export function degreesToRadians(degrees) {
568
535
  * @param {Units} [finalUnit="kilometers"] returned unit
569
536
  * @returns {number} the converted length
570
537
  */
571
- export function convertLength(length, originalUnit, finalUnit) {
572
- if (originalUnit === void 0) { originalUnit = "kilometers"; }
573
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
538
+ export function convertLength(length, originalUnit = "kilometers", finalUnit = "kilometers") {
574
539
  if (!(length >= 0)) {
575
540
  throw new Error("length must be a positive number");
576
541
  }
@@ -584,17 +549,15 @@ export function convertLength(length, originalUnit, finalUnit) {
584
549
  * @param {Units} [finalUnit="kilometers"] returned unit
585
550
  * @returns {number} the converted area
586
551
  */
587
- export function convertArea(area, originalUnit, finalUnit) {
588
- if (originalUnit === void 0) { originalUnit = "meters"; }
589
- if (finalUnit === void 0) { finalUnit = "kilometers"; }
552
+ export function convertArea(area, originalUnit = "meters", finalUnit = "kilometers") {
590
553
  if (!(area >= 0)) {
591
554
  throw new Error("area must be a positive number");
592
555
  }
593
- var startFactor = areaFactors[originalUnit];
556
+ const startFactor = areaFactors[originalUnit];
594
557
  if (!startFactor) {
595
558
  throw new Error("invalid original units");
596
559
  }
597
- var finalFactor = areaFactors[finalUnit];
560
+ const finalFactor = areaFactors[finalUnit];
598
561
  if (!finalFactor) {
599
562
  throw new Error("invalid final units");
600
563
  }
@@ -618,7 +581,7 @@ export function isNumber(num) {
618
581
  * isObject
619
582
  *
620
583
  * @param {*} input variable to validate
621
- * @returns {boolean} true/false
584
+ * @returns {boolean} true/false, including false for Arrays and Functions
622
585
  * @example
623
586
  * turf.isObject({elevation: 10})
624
587
  * //=true
@@ -626,7 +589,7 @@ export function isNumber(num) {
626
589
  * //=false
627
590
  */
628
591
  export function isObject(input) {
629
- return !!input && input.constructor === Object;
592
+ return input !== null && typeof input === "object" && !Array.isArray(input);
630
593
  }
631
594
  /**
632
595
  * Validate BBox
@@ -634,7 +597,7 @@ export function isObject(input) {
634
597
  * @private
635
598
  * @param {Array<number>} bbox BBox to validate
636
599
  * @returns {void}
637
- * @throws Error if BBox is not valid
600
+ * @throws {Error} if BBox is not valid
638
601
  * @example
639
602
  * validateBBox([-180, -40, 110, 50])
640
603
  * //=OK
@@ -659,7 +622,7 @@ export function validateBBox(bbox) {
659
622
  if (bbox.length !== 4 && bbox.length !== 6) {
660
623
  throw new Error("bbox must be an Array of 4 or 6 numbers");
661
624
  }
662
- bbox.forEach(function (num) {
625
+ bbox.forEach((num) => {
663
626
  if (!isNumber(num)) {
664
627
  throw new Error("bbox must only contain numbers");
665
628
  }
@@ -671,7 +634,7 @@ export function validateBBox(bbox) {
671
634
  * @private
672
635
  * @param {string|number} id Id to validate
673
636
  * @returns {void}
674
- * @throws Error if Id is not valid
637
+ * @throws {Error} if Id is not valid
675
638
  * @example
676
639
  * validateId([-180, -40, 110, 50])
677
640
  * //=Error
@@ -1,7 +0,0 @@
1
- // Type definitions for geojson 7946.0
2
- // Project: https://geojson.org/
3
- // Definitions by: Jacob Bruun <https://github.com/cobster>
4
- // Arne Schubert <https://github.com/atd-schubert>
5
- // Jeff Jacobson <https://github.com/JeffJacobson>
6
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
- // TypeScript Version: 2.3
@@ -1,7 +1,9 @@
1
- import { BBox, CollectionTypes, Feature, FeatureCollection, GeoJSONObject, Geometries, Geometry, GeometryCollection, GeometryObject, GeometryTypes, Id, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Position, Properties, Types } from "./lib/geojson";
2
- export { Id, Properties, BBox, Position, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryObject, GeoJSONObject, GeometryCollection, Geometry, GeometryTypes, Types, CollectionTypes, Geometries, Feature, FeatureCollection, };
1
+ import { BBox, Feature, FeatureCollection, Geometry, GeometryCollection, GeometryObject, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Position, GeoJsonProperties } from "geojson";
2
+ import { Id } from "./lib/geojson";
3
+ export * from "./lib/geojson";
3
4
  export declare type Coord = Feature<Point> | Point | Position;
4
- export declare type Units = "meters" | "millimeters" | "centimeters" | "kilometers" | "acres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees" | "hectares";
5
+ export declare type Units = "meters" | "metres" | "millimeters" | "millimetres" | "centimeters" | "centimetres" | "kilometers" | "kilometres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees";
6
+ export declare type AreaUnits = Exclude<Units, "radians" | "degrees"> | "acres" | "hectares";
5
7
  export declare type Grid = "point" | "square" | "hex" | "triangle";
6
8
  export declare type Corners = "sw" | "se" | "nw" | "ne" | "center" | "centroid";
7
9
  export declare type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
@@ -15,32 +17,24 @@ export declare type AllGeoJSON = Feature | FeatureCollection | Geometry | Geomet
15
17
  * @memberof helpers
16
18
  * @type {number}
17
19
  */
18
- export declare let earthRadius: number;
20
+ export declare const earthRadius = 6371008.8;
19
21
  /**
20
22
  * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
21
23
  *
22
- * @memberof helpers
23
- * @type {Object}
24
- */
25
- export declare let factors: {
26
- [key: string]: number;
27
- };
28
- /**
29
- * Units of measurement factors based on 1 meter.
24
+ * Keys are the name of the unit, values are the number of that unit in a single radian
30
25
  *
31
26
  * @memberof helpers
32
27
  * @type {Object}
33
28
  */
34
- export declare let unitsFactors: {
35
- [key: string]: number;
36
- };
29
+ export declare const factors: Record<Units, number>;
37
30
  /**
31
+
38
32
  * Area of measurement factors based on 1 square meter.
39
33
  *
40
34
  * @memberof helpers
41
35
  * @type {Object}
42
36
  */
43
- export declare let areaFactors: any;
37
+ export declare const areaFactors: Record<AreaUnits, number>;
44
38
  /**
45
39
  * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
46
40
  *
@@ -61,7 +55,7 @@ export declare let areaFactors: any;
61
55
  *
62
56
  * //=feature
63
57
  */
64
- export declare function feature<G = Geometry, P = Properties>(geom: G, properties?: P, options?: {
58
+ export declare function feature<G extends GeometryObject = Geometry, P = GeoJsonProperties>(geom: G | null, properties?: P, options?: {
65
59
  bbox?: BBox;
66
60
  id?: Id;
67
61
  }): Feature<G, P>;
@@ -80,7 +74,7 @@ export declare function feature<G = Geometry, P = Properties>(geom: G, propertie
80
74
  * var geometry = turf.geometry(type, coordinates);
81
75
  * // => geometry
82
76
  */
83
- export declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], _options?: Record<string, never>): Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon;
77
+ export declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], _options?: Record<string, never>): Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
84
78
  /**
85
79
  * Creates a {@link Point} {@link Feature} from a Position.
86
80
  *
@@ -96,7 +90,7 @@ export declare function geometry(type: "Point" | "LineString" | "Polygon" | "Mul
96
90
  *
97
91
  * //=point
98
92
  */
99
- export declare function point<P = Properties>(coordinates: Position, properties?: P, options?: {
93
+ export declare function point<P = GeoJsonProperties>(coordinates: Position, properties?: P, options?: {
100
94
  bbox?: BBox;
101
95
  id?: Id;
102
96
  }): Feature<Point, P>;
@@ -120,7 +114,7 @@ export declare function point<P = Properties>(coordinates: Position, properties?
120
114
  *
121
115
  * //=points
122
116
  */
123
- export declare function points<P = Properties>(coordinates: Position[], properties?: P, options?: {
117
+ export declare function points<P = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
124
118
  bbox?: BBox;
125
119
  id?: Id;
126
120
  }): FeatureCollection<Point, P>;
@@ -139,7 +133,7 @@ export declare function points<P = Properties>(coordinates: Position[], properti
139
133
  *
140
134
  * //=polygon
141
135
  */
142
- export declare function polygon<P = Properties>(coordinates: Position[][], properties?: P, options?: {
136
+ export declare function polygon<P = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
143
137
  bbox?: BBox;
144
138
  id?: Id;
145
139
  }): Feature<Polygon, P>;
@@ -161,7 +155,7 @@ export declare function polygon<P = Properties>(coordinates: Position[][], prope
161
155
  *
162
156
  * //=polygons
163
157
  */
164
- export declare function polygons<P = Properties>(coordinates: Position[][][], properties?: P, options?: {
158
+ export declare function polygons<P = GeoJsonProperties>(coordinates: Position[][][], properties?: P, options?: {
165
159
  bbox?: BBox;
166
160
  id?: Id;
167
161
  }): FeatureCollection<Polygon, P>;
@@ -182,7 +176,7 @@ export declare function polygons<P = Properties>(coordinates: Position[][][], pr
182
176
  * //=linestring1
183
177
  * //=linestring2
184
178
  */
185
- export declare function lineString<P = Properties>(coordinates: Position[], properties?: P, options?: {
179
+ export declare function lineString<P = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
186
180
  bbox?: BBox;
187
181
  id?: Id;
188
182
  }): Feature<LineString, P>;
@@ -205,7 +199,7 @@ export declare function lineString<P = Properties>(coordinates: Position[], prop
205
199
  *
206
200
  * //=linestrings
207
201
  */
208
- export declare function lineStrings<P = Properties>(coordinates: Position[][], properties?: P, options?: {
202
+ export declare function lineStrings<P = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
209
203
  bbox?: BBox;
210
204
  id?: Id;
211
205
  }): FeatureCollection<LineString, P>;
@@ -231,7 +225,7 @@ export declare function lineStrings<P = Properties>(coordinates: Position[][], p
231
225
  *
232
226
  * //=collection
233
227
  */
234
- export declare function featureCollection<G = Geometry, P = Properties>(features: Array<Feature<G, P>>, options?: {
228
+ export declare function featureCollection<G extends GeometryObject = Geometry, P = GeoJsonProperties>(features: Array<Feature<G, P>>, options?: {
235
229
  bbox?: BBox;
236
230
  id?: Id;
237
231
  }): FeatureCollection<G, P>;
@@ -252,7 +246,7 @@ export declare function featureCollection<G = Geometry, P = Properties>(features
252
246
  *
253
247
  * //=multiLine
254
248
  */
255
- export declare function multiLineString<P = Properties>(coordinates: Position[][], properties?: P, options?: {
249
+ export declare function multiLineString<P = GeoJsonProperties>(coordinates: Position[][], properties?: P, options?: {
256
250
  bbox?: BBox;
257
251
  id?: Id;
258
252
  }): Feature<MultiLineString, P>;
@@ -273,7 +267,7 @@ export declare function multiLineString<P = Properties>(coordinates: Position[][
273
267
  *
274
268
  * //=multiPt
275
269
  */
276
- export declare function multiPoint<P = Properties>(coordinates: Position[], properties?: P, options?: {
270
+ export declare function multiPoint<P = GeoJsonProperties>(coordinates: Position[], properties?: P, options?: {
277
271
  bbox?: BBox;
278
272
  id?: Id;
279
273
  }): Feature<MultiPoint, P>;
@@ -295,7 +289,7 @@ export declare function multiPoint<P = Properties>(coordinates: Position[], prop
295
289
  * //=multiPoly
296
290
  *
297
291
  */
298
- export declare function multiPolygon<P = Properties>(coordinates: Position[][][], properties?: P, options?: {
292
+ export declare function multiPolygon<P = GeoJsonProperties>(coordinates: Position[][][], properties?: P, options?: {
299
293
  bbox?: BBox;
300
294
  id?: Id;
301
295
  }): Feature<MultiPolygon, P>;
@@ -317,7 +311,7 @@ export declare function multiPolygon<P = Properties>(coordinates: Position[][][]
317
311
  *
318
312
  * // => collection
319
313
  */
320
- export declare function geometryCollection<P = Properties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
314
+ export declare function geometryCollection<P = GeoJsonProperties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
321
315
  bbox?: BBox;
322
316
  id?: Id;
323
317
  }): Feature<GeometryCollection, P>;
@@ -411,7 +405,7 @@ export declare function convertLength(length: number, originalUnit?: Units, fina
411
405
  * @param {Units} [finalUnit="kilometers"] returned unit
412
406
  * @returns {number} the converted area
413
407
  */
414
- export declare function convertArea(area: number, originalUnit?: Units, finalUnit?: Units): number;
408
+ export declare function convertArea(area: number, originalUnit?: AreaUnits, finalUnit?: AreaUnits): number;
415
409
  /**
416
410
  * isNumber
417
411
  *
@@ -428,7 +422,7 @@ export declare function isNumber(num: any): boolean;
428
422
  * isObject
429
423
  *
430
424
  * @param {*} input variable to validate
431
- * @returns {boolean} true/false
425
+ * @returns {boolean} true/false, including false for Arrays and Functions
432
426
  * @example
433
427
  * turf.isObject({elevation: 10})
434
428
  * //=true
@@ -442,7 +436,7 @@ export declare function isObject(input: any): boolean;
442
436
  * @private
443
437
  * @param {Array<number>} bbox BBox to validate
444
438
  * @returns {void}
445
- * @throws Error if BBox is not valid
439
+ * @throws {Error} if BBox is not valid
446
440
  * @example
447
441
  * validateBBox([-180, -40, 110, 50])
448
442
  * //=OK
@@ -464,7 +458,7 @@ export declare function validateBBox(bbox: any): void;
464
458
  * @private
465
459
  * @param {string|number} id Id to validate
466
460
  * @returns {void}
467
- * @throws Error if Id is not valid
461
+ * @throws {Error} if Id is not valid
468
462
  * @example
469
463
  * validateId([-180, -40, 110, 50])
470
464
  * //=Error