@konfirm/geojson 1.0.0 → 1.0.1-beta.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 (127) hide show
  1. package/README.md +7 -7
  2. package/dist/{geojson.d.ts → main.d.mts} +18 -79
  3. package/dist/main.d.ts +137 -15
  4. package/dist/main.global.js +853 -0
  5. package/dist/main.global.js.map +1 -0
  6. package/dist/main.js +824 -0
  7. package/dist/main.js.map +1 -0
  8. package/dist/main.mjs +772 -0
  9. package/dist/main.mjs.map +1 -0
  10. package/package.json +101 -63
  11. package/.editorconfig +0 -16
  12. package/.github/workflows/release.yml +0 -21
  13. package/.github/workflows/tests.yml +0 -56
  14. package/CHANGELOG.md +0 -21
  15. package/dist/Domain/Constants.d.ts +0 -5
  16. package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +0 -3
  17. package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +0 -6
  18. package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +0 -4
  19. package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +0 -11
  20. package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +0 -4
  21. package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +0 -3
  22. package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +0 -4
  23. package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +0 -3
  24. package/dist/Domain/GeoJSON/Concept/Position.d.ts +0 -7
  25. package/dist/Domain/GeoJSON/Feature.d.ts +0 -12
  26. package/dist/Domain/GeoJSON/FeatureCollection.d.ts +0 -8
  27. package/dist/Domain/GeoJSON/GeoJSON.d.ts +0 -7
  28. package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +0 -11
  29. package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +0 -7
  30. package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +0 -8
  31. package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +0 -7
  32. package/dist/Domain/GeoJSON/Geometry/Point.d.ts +0 -11
  33. package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +0 -11
  34. package/dist/Domain/GeoJSON/Geometry.d.ts +0 -9
  35. package/dist/Domain/GeoJSON/GeometryCollection.d.ts +0 -8
  36. package/dist/Domain/GeoJSON/GeometryObject.d.ts +0 -12
  37. package/dist/Domain/Guards/Number.d.ts +0 -3
  38. package/dist/Domain/Guards/Tuple.d.ts +0 -3
  39. package/dist/Domain/Iterator/IterablePair.d.ts +0 -32
  40. package/dist/Domain/Iterator/SimpleGeometry.d.ts +0 -90
  41. package/dist/Domain/Utility/Calculate.d.ts +0 -9
  42. package/dist/Domain/Utility/Distance.d.ts +0 -3
  43. package/dist/Domain/Utility/Intersect.d.ts +0 -2
  44. package/dist/Domain/Utility/Segments.d.ts +0 -2
  45. package/dist/Domain/Utility/Winding.d.ts +0 -3
  46. package/dist/geojson.cjs.js +0 -655
  47. package/dist/geojson.cjs.min.js +0 -1
  48. package/dist/geojson.es.js +0 -627
  49. package/dist/geojson.es.min.js +0 -1
  50. package/dist/geojson.js +0 -660
  51. package/dist/geojson.min.js +0 -1
  52. package/rollup.config.mjs +0 -43
  53. package/source/Domain/Constants.ts +0 -5
  54. package/source/Domain/GeoJSON/Concept/Altitude.ts +0 -9
  55. package/source/Domain/GeoJSON/Concept/BoundingBox.ts +0 -31
  56. package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -12
  57. package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -23
  58. package/source/Domain/GeoJSON/Concept/InteriorRing.ts +0 -12
  59. package/source/Domain/GeoJSON/Concept/Latitude.ts +0 -7
  60. package/source/Domain/GeoJSON/Concept/LinearRing.ts +0 -14
  61. package/source/Domain/GeoJSON/Concept/Longitude.ts +0 -7
  62. package/source/Domain/GeoJSON/Concept/Position.ts +0 -18
  63. package/source/Domain/GeoJSON/Feature.ts +0 -24
  64. package/source/Domain/GeoJSON/FeatureCollection.ts +0 -16
  65. package/source/Domain/GeoJSON/GeoJSON.ts +0 -9
  66. package/source/Domain/GeoJSON/Geometry/LineString.ts +0 -12
  67. package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -9
  68. package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -10
  69. package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -9
  70. package/source/Domain/GeoJSON/Geometry/Point.ts +0 -12
  71. package/source/Domain/GeoJSON/Geometry/Polygon.ts +0 -20
  72. package/source/Domain/GeoJSON/Geometry.ts +0 -11
  73. package/source/Domain/GeoJSON/GeometryCollection.ts +0 -23
  74. package/source/Domain/GeoJSON/GeometryObject.ts +0 -20
  75. package/source/Domain/Guards/Number.ts +0 -13
  76. package/source/Domain/Guards/Tuple.ts +0 -6
  77. package/source/Domain/Guards/Utility.ts +0 -1
  78. package/source/Domain/Iterator/IterablePair.ts +0 -47
  79. package/source/Domain/Iterator/SimpleGeometry.ts +0 -137
  80. package/source/Domain/Utility/Calculate.ts +0 -143
  81. package/source/Domain/Utility/Distance.ts +0 -56
  82. package/source/Domain/Utility/Intersect.ts +0 -42
  83. package/source/Domain/Utility/Numeric.ts +0 -8
  84. package/source/Domain/Utility/Segments.ts +0 -5
  85. package/source/Domain/Utility/Winding.ts +0 -19
  86. package/source/main.ts +0 -20
  87. package/test/Domain/GeoJSON/Concept/Altitude.ts +0 -58
  88. package/test/Domain/GeoJSON/Concept/BoundingBox.ts +0 -77
  89. package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -65
  90. package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -56
  91. package/test/Domain/GeoJSON/Concept/InteriorRing.ts +0 -65
  92. package/test/Domain/GeoJSON/Concept/Latitude.ts +0 -56
  93. package/test/Domain/GeoJSON/Concept/LinearRing.ts +0 -63
  94. package/test/Domain/GeoJSON/Concept/Longitude.ts +0 -56
  95. package/test/Domain/GeoJSON/Concept/Position.ts +0 -56
  96. package/test/Domain/GeoJSON/Feature.ts +0 -9
  97. package/test/Domain/GeoJSON/FeatureCollection.ts +0 -9
  98. package/test/Domain/GeoJSON/GeoJSON.ts +0 -21
  99. package/test/Domain/GeoJSON/Geometry/LineString.ts +0 -11
  100. package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -11
  101. package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -11
  102. package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -11
  103. package/test/Domain/GeoJSON/Geometry/Point.ts +0 -11
  104. package/test/Domain/GeoJSON/Geometry/Polygon.ts +0 -11
  105. package/test/Domain/GeoJSON/Geometry.ts +0 -9
  106. package/test/Domain/GeoJSON/GeometryCollection.ts +0 -9
  107. package/test/Domain/GeoJSON/GeometryObject.ts +0 -4
  108. package/test/Domain/Guards/Number.ts +0 -49
  109. package/test/Domain/Guards/Tuple.ts +0 -27
  110. package/test/Domain/Iterator/IterablePair.ts +0 -203
  111. package/test/Domain/Iterator/SimpleGeometry.ts +0 -195
  112. package/test/Domain/Utility/Calculate.ts +0 -178
  113. package/test/Domain/Utility/Distance.ts +0 -19
  114. package/test/Domain/Utility/Intersect.ts +0 -54
  115. package/test/Domain/Utility/Numeric.ts +0 -30
  116. package/test/Domain/Utility/Winding.ts +0 -52
  117. package/test/README.ts +0 -123
  118. package/test/data/Distance.ts +0 -51
  119. package/test/data/HolySee.ts +0 -74
  120. package/test/data/Intersect.ts +0 -300
  121. package/test/data/Italy.ts +0 -2883
  122. package/test/data/SanMarino.ts +0 -83
  123. package/test/data/Shapes.ts +0 -107
  124. package/test/helper/geometry.ts +0 -76
  125. package/test/helper/malform.ts +0 -82
  126. package/test/main.ts +0 -4
  127. package/tsconfig.json +0 -12
@@ -1,56 +0,0 @@
1
- import test from 'tape';
2
- import { each } from 'template-literal-each';
3
- import * as Export from '../../../../source/Domain/GeoJSON/Concept/Latitude';
4
- import { exported } from '../../../helper/geometry';
5
-
6
- exported('Domain/GeoJSON/Concept/Latitude', Export, 'isLatitude', 'isStrictLatitude');
7
-
8
- const { isLatitude, isStrictLatitude } = Export;
9
-
10
- test('Domain/GeoJSON/Concept/Latitude - isLatitude', (t) => {
11
- each`
12
- input | valid
13
- ----------------|-------
14
- ${0} | yes
15
- ${0.0000000001} | yes
16
- ${51.9851034} | yes
17
- ${-90} | yes
18
- ${-90.1} | yes
19
- ${90} | yes
20
- ${90.1} | yes
21
- ${-Infinity} | no
22
- ${Infinity} | no
23
- ${NaN} | no
24
- ${'1234'} | no
25
- ${false} | no
26
- ${true} | no
27
- `(({ input, valid }) => {
28
- t.equal(isLatitude(input), valid === 'yes', `${input} ${valid}`);
29
- });
30
-
31
- t.end();
32
- });
33
-
34
- test('Domain/GeoJSON/Concept/Latitude - isStrictLatitude', (t) => {
35
- each`
36
- input | valid
37
- ----------------|-------
38
- ${0} | yes
39
- ${0.0000000001} | yes
40
- ${51.9851034} | yes
41
- ${-90} | yes
42
- ${-90.1} | no
43
- ${90} | yes
44
- ${90.1} | no
45
- ${-Infinity} | no
46
- ${Infinity} | no
47
- ${NaN} | no
48
- ${'1234'} | no
49
- ${false} | no
50
- ${true} | no
51
- `(({ input, valid }) => {
52
- t.equal(isStrictLatitude(input), valid === 'yes', `${input} ${valid}`);
53
- });
54
-
55
- t.end();
56
- });
@@ -1,63 +0,0 @@
1
- import test from 'tape';
2
- import { each } from 'template-literal-each';
3
- import * as Export from '../../../../source/Domain/GeoJSON/Concept/LinearRing';
4
- import { exported } from '../../../helper/geometry';
5
- import { coordinates as Italy } from '../../../data/Italy';
6
- import { coordinates as SanMarino } from '../../../data/SanMarino';
7
- import { coordinates as HolySee } from '../../../data/HolySee';
8
-
9
- exported('Domain/GeoJSON/Concept/LinearRing', Export, 'isLinearRing', 'isStrictLinearRing');
10
-
11
- const { isLinearRing, isStrictLinearRing } = Export;
12
-
13
- test('Domain/GeoJSON/Concept/LinearRing - isLinearRing', (t) => {
14
- each`
15
- input | valid
16
- -------------------------------------------------|----
17
- ${undefined} | no
18
- ${null} | no
19
- ${'[[1,0],[1,1],[0,1],[1,0]]'} | no
20
- ${[[1, 0], [1, 1], [0, 1], [0, 0.5], [1, 0]]} | yes
21
- ${[[1, 0], [0, 0.5], [0, 1], [1, 1], [1, 0]]} | yes
22
- ${[[1, 0], [1, 1], [0, 1], [1, 0]]} | yes
23
- ${[[1, 0], [1, 1], [0, 1], [0, 0]]} | no
24
- ${[[1, 0], [1, 1], [1, 0]]} | no
25
- ${[[1, 0], [1, 0]]} | no
26
- ${[[1, 0]]} | no
27
- ${[[-181, -91], [0, -91], [0, 91], [-181, -91]]} | yes
28
- `(({ input, valid }) => {
29
- t.equal(isLinearRing(input), valid === 'yes', `[${input}] isLinearRing ${valid}`);
30
- });
31
-
32
- t.ok(Italy.every((polygon) => polygon.every(isLinearRing)), 'coordinates for Italy polygon all match isLinearRing');
33
- t.notOk(SanMarino.every(isLinearRing), 'coordinates for SanMarino does not match isLinearRing');
34
- t.notOk(HolySee.every(isLinearRing), 'coordinates for HolySee does not match isLinearRing');
35
-
36
- t.end();
37
- });
38
-
39
- test('Domain/GeoJSON/Concept/LinearRing - isStrictLinearRing', (t) => {
40
- each`
41
- input | valid
42
- -------------------------------------------------|----
43
- ${undefined} | no
44
- ${null} | no
45
- ${'[[1,0],[1,1],[0,1],[1,0]]'} | no
46
- ${[[1, 0], [1, 1], [0, 1], [0, 0.5], [1, 0]]} | yes
47
- ${[[1, 0], [0, 0.5], [0, 1], [1, 1], [1, 0]]} | yes
48
- ${[[1, 0], [1, 1], [0, 1], [1, 0]]} | yes
49
- ${[[1, 0], [1, 1], [0, 1], [0, 0]]} | no
50
- ${[[1, 0], [1, 1], [1, 0]]} | no
51
- ${[[1, 0], [1, 0]]} | no
52
- ${[[1, 0]]} | no
53
- ${[[-181, -91], [0, -91], [0, 91], [-181, -91]]} | no
54
- `(({ input, valid }) => {
55
- t.equal(isStrictLinearRing(input), valid === 'yes', `[${input}] isStrictLinearRing ${valid}`);
56
- });
57
-
58
- t.ok(Italy.every((polygon) => polygon.every(isStrictLinearRing)), 'coordinates for Italy polygon all match isStrictLinearRing');
59
- t.notOk(SanMarino.every(isStrictLinearRing), 'coordinates for SanMarino does not match isStrictLinearRing');
60
- t.notOk(HolySee.every(isStrictLinearRing), 'coordinates for HolySee does not match isStrictLinearRing');
61
-
62
- t.end();
63
- });
@@ -1,56 +0,0 @@
1
- import test from 'tape';
2
- import { each } from 'template-literal-each';
3
- import * as Export from '../../../../source/Domain/GeoJSON/Concept/Longitude';
4
- import { exported } from '../../../helper/geometry';
5
-
6
- exported('Domain/GeoJSON/Concept/Longitude', Export, 'isLongitude', 'isStrictLongitude');
7
-
8
- const { isLongitude, isStrictLongitude } = Export;
9
-
10
- test('Domain/GeoJSON/Concept/Longitude - isLongitude', (t) => {
11
- each`
12
- input | valid
13
- ----------------|-------
14
- ${0} | yes
15
- ${0.0000000001} | yes
16
- ${5.8987296} | yes
17
- ${-180} | yes
18
- ${-180.1} | yes
19
- ${180} | yes
20
- ${180.1} | yes
21
- ${-Infinity} | no
22
- ${Infinity} | no
23
- ${NaN} | no
24
- ${'1234'} | no
25
- ${false} | no
26
- ${true} | no
27
- `(({ input, valid }) => {
28
- t.equal(isLongitude(input), valid === 'yes', `${input} ${valid}`);
29
- });
30
-
31
- t.end();
32
- });
33
-
34
- test('Domain/GeoJSON/Concept/Longitude - isStrictLongitude', (t) => {
35
- each`
36
- input | valid
37
- ----------------|-------
38
- ${0} | yes
39
- ${0.0000000001} | yes
40
- ${5.8987296} | yes
41
- ${-180} | yes
42
- ${-180.1} | no
43
- ${180} | yes
44
- ${180.1} | no
45
- ${-Infinity} | no
46
- ${Infinity} | no
47
- ${NaN} | no
48
- ${'1234'} | no
49
- ${false} | no
50
- ${true} | no
51
- `(({ input, valid }) => {
52
- t.equal(isStrictLongitude(input), valid === 'yes', `${input} ${valid}`);
53
- });
54
-
55
- t.end();
56
- });
@@ -1,56 +0,0 @@
1
- import test from 'tape';
2
- import * as Export from '../../../../source/Domain/GeoJSON/Concept/Position';
3
- import { coordinates } from '../../../data/HolySee';
4
- import { exported } from '../../../helper/geometry';
5
-
6
- exported('Domain/GeoJSON/Concept/Position', Export, 'isPosition', 'isStrictPosition', 'isEquivalentPosition');
7
-
8
- const { isPosition, isStrictPosition, isEquivalentPosition } = Export;
9
- const altitude = coordinates.map(([lon, lat, alt = 1.23]) => [lon, lat, alt]);
10
-
11
- test('Domain/GeoJSON/Concept/Position - isPosition', (t) => {
12
- t.ok(coordinates.every(isPosition), 'all coordinates match isPosition');
13
- t.ok(altitude.every(isPosition), 'all coordinates with altitude match isPosition');
14
-
15
- t.notOk(isPosition([Infinity, 0, 0]), `[Infinity, 0, 0] is not a Position`);
16
- t.notOk(isPosition([0, Infinity, 0]), `[0, Infinity, 0] is not a Position`);
17
- t.notOk(isPosition([0, 0, Infinity]), `[0, 0, Infinity] is not a Position`);
18
- t.ok(isPosition([0, 0, 0]), `[0, 0, 0] is Position`);
19
- t.ok(isPosition([-181, 0, 0]), `[-181, 0, 0] is Position`);
20
- t.ok(isPosition([0, -91, 0]), `[0, -91, 0] is Position`);
21
- t.ok(isPosition([0, 0, -7000000]), `[0, 0, -7000000] is Position`);
22
- t.ok(isPosition([-181, -91, 0]), `[-181, -91, 0] is Position`);
23
- t.ok(isPosition([0, -91, -7000000]), `[0, -91, -7000000] is Position`);
24
- t.ok(isPosition([-181, 0, -7000000]), `[-181, 0, -7000000] is Position`);
25
- t.ok(isPosition([-181, -91, -7000000]), `[-181, -91, -7000000] is Position`);
26
-
27
- t.end();
28
- });
29
-
30
- test('Domain/GeoJSON/Concept/Position - isStrictPosition', (t) => {
31
- t.ok(coordinates.every(isStrictPosition), 'all coordinates match isStrictPosition');
32
- t.ok(altitude.every(isStrictPosition), 'all coordinates with altitude match isStrictPosition');
33
-
34
- t.notOk(isStrictPosition([Infinity, 0, 0]), `[Infinity, 0, 0] is not a strict Position`);
35
- t.notOk(isStrictPosition([0, Infinity, 0]), `[0, Infinity, 0] is not a strict Position`);
36
- t.notOk(isStrictPosition([0, 0, Infinity]), `[0, 0, Infinity] is not a strict Position`);
37
- t.ok(isStrictPosition([0, 0, 0]), `[0, 0, 0] is strict Position`);
38
- t.notOk(isStrictPosition([-181, 0, 0]), `[-181, 0, 0] is not a strict Position`);
39
- t.notOk(isStrictPosition([0, -91, 0]), `[0, -91, 0] is not a strict Position`);
40
- t.notOk(isStrictPosition([0, 0, -7000000]), `[0, 0, -7000000] is not a strict Position`);
41
- t.notOk(isStrictPosition([-181, -91, 0]), `[-181, -91, 0] is not a strict Position`);
42
- t.notOk(isStrictPosition([0, -91, -7000000]), `[0, -91, -7000000] is not a strict Position`);
43
- t.notOk(isStrictPosition([-181, 0, -7000000]), `[-181, 0, -7000000] is not a strict Position`);
44
- t.notOk(isStrictPosition([-181, -91, -7000000]), `[-181, -91, -7000000] is not a strict Position`);
45
-
46
- t.end();
47
- });
48
-
49
- test('Domain/GeoJSON/Concept/Position - isEquivalentPosition', (t) => {
50
- t.ok(isEquivalentPosition([1.23456789, 2.3456789], [1.23456789, 2.3456789]), `[1.23456789,2.3456789] and [1.23456789,2.3456789] are equivalent`);
51
- t.ok(isEquivalentPosition([1.23456789, 2.3456789, 3.456789], [1.23456789, 2.3456789, 3.456789]), `[1.23456789,2.3456789,3.456789] and [1.23456789,2.3456789,3.456789] are equivalent`);
52
- t.notOk(isEquivalentPosition([1.23456789, 2.3456789, 3.456789], [1.23456789, 2.3456789]), `[1.23456789,2.3456789,3.456789] and [1.23456789,2.3456789] are not equivalent`);
53
- t.notOk(isEquivalentPosition([1.23456789, 2.3456789], [1.23456789, 2.3456789, , 3.456789]), `[1.23456789,2.3456789] and [1.23456789,2.3456789,,3.456789] are not equivalent`);
54
-
55
- t.end();
56
- });
@@ -1,9 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/Feature';
2
- import { runner } from '../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Feature',
6
- Export,
7
- 'isFeature',
8
- 'isStrictFeature',
9
- );
@@ -1,9 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/FeatureCollection';
2
- import { runner } from '../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/FeatureCollection',
6
- Export,
7
- 'isFeatureCollection',
8
- 'isStrictFeatureCollection',
9
- );
@@ -1,21 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/GeoJSON';
2
- import { runner } from '../../helper/geometry';
3
-
4
- const types = [
5
- 'Point',
6
- 'MultiPoint',
7
- 'LineString',
8
- 'MultiLineString',
9
- 'Polygon',
10
- 'MultiPolygon',
11
- 'GeometryCollection',
12
- 'Feature',
13
- 'FeatureCollection',
14
- ]
15
-
16
- runner(
17
- 'Domain/GeoJSON/GeoJSON',
18
- Export,
19
- ['isGeoJSON', types],
20
- ['isStrictGeoJSON', types],
21
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/LineString';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/LineString',
6
- Export,
7
- ['isLineStringCoordinates', ['MultiPoint']],
8
- 'isLineString',
9
- ['isStrictLineStringCoordinates', ['MultiPoint']],
10
- 'isStrictLineString',
11
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/MultiLineString';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/MultiLineString',
6
- Export,
7
- ['isMultiLineStringCoordinates', ['Polygon']],
8
- 'isMultiLineString',
9
- ['isStrictMultiLineStringCoordinates', ['Polygon']],
10
- 'isStrictMultiLineString',
11
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/MultiPoint';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/MultiPoint',
6
- Export,
7
- ['isMultiPointCoordinates', ['LineString']],
8
- 'isMultiPoint',
9
- ['isStrictMultiPointCoordinates', ['LineString']],
10
- 'isStrictMultiPoint',
11
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/MultiPolygon';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/MultiPolygon',
6
- Export,
7
- 'isMultiPolygonCoordinates',
8
- 'isMultiPolygon',
9
- 'isStrictMultiPolygonCoordinates',
10
- 'isStrictMultiPolygon',
11
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/Point';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/Point',
6
- Export,
7
- 'isPointCoordinates',
8
- 'isPoint',
9
- 'isStrictPointCoordinates',
10
- 'isStrictPoint',
11
- );
@@ -1,11 +0,0 @@
1
- import * as Export from '../../../../source/Domain/GeoJSON/Geometry/Polygon';
2
- import { runner } from '../../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry/Polygon',
6
- Export,
7
- 'isPolygonCoordinates',
8
- 'isPolygon',
9
- 'isStrictPolygonCoordinates',
10
- 'isStrictPolygon',
11
- );
@@ -1,9 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/Geometry';
2
- import { runner } from '../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/Geometry',
6
- Export,
7
- ['isGeometry', ['Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon']],
8
- ['isStrictGeometry', ['Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon']],
9
- );
@@ -1,9 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/GeometryCollection';
2
- import { runner } from '../../helper/geometry';
3
-
4
- runner(
5
- 'Domain/GeoJSON/GeometryCollection',
6
- Export,
7
- 'isGeometryCollection',
8
- 'isStrictGeometryCollection',
9
- );
@@ -1,4 +0,0 @@
1
- import * as Export from '../../../source/Domain/GeoJSON/GeometryObject';
2
- import { exported } from '../../helper/geometry';
3
-
4
- exported('Domain/GeoJSON/GeometryObject', Export, 'isGeometryObject');
@@ -1,49 +0,0 @@
1
- import test from 'tape';
2
- import { each } from 'template-literal-each';
3
- import * as Export from '../../../source/Domain/Guards/Number';
4
- import { exported } from '../../helper/geometry';
5
-
6
- exported('Domain/Guards/Number - exports', Export, 'isNumberValue', 'isNumberBetween');
7
-
8
- const { isNumberValue, isNumberBetween } = Export;
9
-
10
- test('Domain/Guards/Number - isNumberValue', (t) => {
11
- each`
12
- input | valid
13
- ---------------------------|-------
14
- ${123} | yes
15
- ${Number.MAX_SAFE_INTEGER} | yes
16
- ${Number.MIN_SAFE_INTEGER} | yes
17
- ${Number.MAX_VALUE} | yes
18
- ${Number.MIN_VALUE} | yes
19
- ${Math.PI} | yes
20
- ${-Math.PI} | yes
21
- ${Infinity} | no
22
- ${-Infinity} | no
23
- ${NaN} | no
24
- ${'123'} | no
25
- `(({ input, valid }) => {
26
- t.equal(isNumberValue(input), valid === 'yes', `${input} isNumberValue ${valid}`);
27
- });
28
-
29
- t.end();
30
- });
31
-
32
- test('Domain/Guards/Number - isNumberBetween', (t) => {
33
- each`
34
- input | min | max | valid
35
- -------------|--------|--------------|-------
36
- ${1} | ${0} | ${2} | yes
37
- ${0} | ${0} | ${2} | yes
38
- ${-1} | ${0} | ${2} | no
39
- ${Infinity} | ${0} | ${undefined} | no
40
- ${Math.PI} | ${0} | ${undefined} | yes
41
- ${0} | ${-10} | ${10} | yes
42
- `(({ input, min, max, valid }: any) => {
43
- const between = isNumberBetween(min, max);
44
-
45
- t.equal(between(input), valid === 'yes', `${input} is ${valid === 'no' ? 'not ' : ''}between ${min} and ${max}`);
46
- });
47
-
48
- t.end();
49
- });
@@ -1,27 +0,0 @@
1
- import { isBoolean, isNumber, isString } from '@konfirm/guard';
2
- import test from 'tape';
3
- import * as Export from '../../../source/Domain/Guards/Tuple';
4
- import { exported } from '../../helper/geometry';
5
-
6
- exported('Domain/Guards/Tuple - exports', Export, 'isTuple');
7
-
8
- const { isTuple } = Export;
9
-
10
- test('Domain/Guards/Tuple - isTuple', (t) => {
11
- const snn = isTuple(isString, isNumber, isNumber);
12
- const bsn = isTuple(isBoolean, isString, isNumber);
13
-
14
- t.notOk(snn(['abc']), `['abc'] does not match isTuple(isString, isNumber, isNumber)`);
15
- t.notOk(snn(['abc', 123]), `['abc', 123] does not match isTuple(isString, isNumber, isNumber)`);
16
- t.ok(snn(['abc', 123, 456]), `['abc', 123, 456] matches isTuple(isString, isNumber, isNumber)`);
17
- t.notOk(snn(['abc', 123, true]), `['abc', 123, true] does not match isTuple(isString, isNumber, isNumber)`);
18
- t.notOk(snn(['abc', false, 123]), `['abc', false, 123] does not match isTuple(isString, isNumber, isNumber)`);
19
- t.notOk(snn(['abc', 123, 456, 789]), `['abc', 456, 789, 123] does not match isTuple(isString, isNumber, isNumber)`);
20
-
21
- t.notOk(bsn(['abc', 123]), `['abc', 123] does not match isTuple(isBoolean, isString, isNumber)`);
22
- t.notOk(bsn(['abc', false, 123]), `['abc', false, 123] does not match isTuple(isBoolean, isString, isNumber)`);
23
- t.ok(bsn([true, 'abc', 123]), `[true, 'abc', 123] matches isTuple(isBoolean, isString, isNumber)`);
24
- t.ok(bsn([false, 'abc', 123]), `[false, 'abc', 123] matches isTuple(isBoolean, isString, isNumber)`);
25
-
26
- t.end();
27
- });
@@ -1,203 +0,0 @@
1
- import test from 'tape';
2
- import * as Export from '../../../source/Domain/Iterator/IterablePair';
3
- import { SimpleGeometryIterator } from '../../../source/Domain/Iterator/SimpleGeometry';
4
- import { Point } from '../../../source/Domain/GeoJSON/Geometry/Point';
5
- import { MultiPoint } from '../../../source/Domain/GeoJSON/Geometry/MultiPoint';
6
- import { LineString } from '../../../source/Domain/GeoJSON/Geometry/LineString';
7
- import { MultiLineString } from '../../../source/Domain/GeoJSON/Geometry/MultiLineString';
8
- import { Polygon } from '../../../source/Domain/GeoJSON/Geometry/Polygon';
9
- import { MultiPolygon } from '../../../source/Domain/GeoJSON/Geometry/MultiPolygon';
10
- import { GeometryCollection } from '../../../source/Domain/GeoJSON/GeometryCollection';
11
- import { Feature } from '../../../source/Domain/GeoJSON/Feature';
12
- import { FeatureCollection } from '../../../source/Domain/GeoJSON/FeatureCollection';
13
- import { explain, exported } from '../../helper/geometry';
14
-
15
- const point: Point = { type: 'Point', coordinates: [0, 0] };
16
- const multipoint: MultiPoint = { type: 'MultiPoint', coordinates: [[1, 1], [2, 2]] };
17
- const linestring: LineString = { type: 'LineString', coordinates: [[3, 3], [4, 4]] };
18
- const multilinestring: MultiLineString = { type: 'MultiLineString', coordinates: [[[5, 5], [6, 6]], [[7, 7], [8, 8]], [[9, 9], [10, 10]]] };
19
- const polygon: Polygon = { type: 'Polygon', coordinates: [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]] };
20
- const multipolygon: MultiPolygon = { type: 'MultiPolygon', coordinates: [[[[4, 4], [4, 5], [5, 5], [5, 4], [4, 4]]], [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]]] };
21
- const geometrycollection: GeometryCollection = { type: 'GeometryCollection', geometries: [point, multipoint] };
22
- const feature: Feature = { type: 'Feature', properties: null, geometry: linestring };
23
- const featurecollection: FeatureCollection = {
24
- type: 'FeatureCollection', features: [
25
- { type: 'Feature', properties: null, geometry: multilinestring },
26
- { type: 'Feature', properties: null, geometry: polygon },
27
- { type: 'Feature', properties: null, geometry: multipolygon },
28
- ]
29
- };
30
-
31
- exported('Domain/Iterator/IterablePair', Export, 'IterablePairIterator');
32
-
33
- const { IterablePairIterator } = Export;
34
-
35
- test('Domain/Iterator/IterablePair - implements Symbol.iterator', (t) => {
36
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(point), new SimpleGeometryIterator(multipoint));
37
-
38
- t.ok(Symbol.iterator in iterator, 'SimpleGeometryIterator implements Symbol.iterator');
39
-
40
- t.end();
41
- });
42
-
43
- test('Domain/Iterator/IterablePair - Point with MultiPoint', (t) => {
44
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(point), new SimpleGeometryIterator(multipoint));
45
- const expanded = [...iterator];
46
- const expected = [
47
- [point, { type: 'Point', coordinates: [1, 1] }],
48
- [point, { type: 'Point', coordinates: [2, 2] }],
49
- ];
50
-
51
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
52
-
53
- let index = 0;
54
- for (const combo of iterator) {
55
- const expect = expected[index++];
56
-
57
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
58
- }
59
-
60
- t.end();
61
- });
62
-
63
- test('Domain/Iterator/IterablePair - MultiPoint with LineString', (t) => {
64
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(multipoint), new SimpleGeometryIterator(linestring));
65
- const expanded = [...iterator];
66
- const expected = [
67
- [{ type: 'Point', coordinates: [1, 1] }, linestring],
68
- [{ type: 'Point', coordinates: [2, 2] }, linestring],
69
- ];
70
-
71
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
72
-
73
- let index = 0;
74
- for (const combo of iterator) {
75
- const expect = expected[index++];
76
-
77
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
78
- }
79
-
80
- t.end();
81
- });
82
-
83
- test('Domain/Iterator/IterablePair - MultiPoint with MultiLineString', (t) => {
84
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(multipoint), new SimpleGeometryIterator(multilinestring));
85
- const expanded = [...iterator];
86
- const expected = [
87
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[5, 5], [6, 6]] }],
88
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[7, 7], [8, 8]] }],
89
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[9, 9], [10, 10]] }],
90
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[5, 5], [6, 6]] }],
91
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[7, 7], [8, 8]] }],
92
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[9, 9], [10, 10]] }],
93
- ];
94
-
95
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
96
-
97
- let index = 0;
98
- for (const combo of iterator) {
99
- const expect = expected[index++];
100
-
101
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
102
- }
103
-
104
- t.end();
105
- });
106
-
107
- test('Domain/Iterator/IterablePair - MultiLineString with Polygon', (t) => {
108
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(multilinestring), new SimpleGeometryIterator(polygon));
109
- const expanded = [...iterator];
110
- const expected = [
111
- [{ type: 'LineString', coordinates: [[5, 5], [6, 6]] }, polygon],
112
- [{ type: 'LineString', coordinates: [[7, 7], [8, 8]] }, polygon],
113
- [{ type: 'LineString', coordinates: [[9, 9], [10, 10]] }, polygon],
114
- ];
115
-
116
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
117
-
118
- let index = 0;
119
- for (const combo of iterator) {
120
- const expect = expected[index++];
121
-
122
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
123
- }
124
-
125
- t.end();
126
- });
127
-
128
- test('Domain/Iterator/IterablePair - Polygon with MultiPolygon', (t) => {
129
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(polygon), new SimpleGeometryIterator(multipolygon));
130
- const expanded = [...iterator];
131
- const expected = [
132
- [polygon, { type: 'Polygon', coordinates: [[[4, 4], [4, 5], [5, 5], [5, 4], [4, 4]]] }],
133
- [polygon, { type: 'Polygon', coordinates: [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]] }],
134
- ];
135
-
136
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
137
-
138
- let index = 0;
139
- for (const combo of iterator) {
140
- const expect = expected[index++];
141
-
142
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
143
- }
144
-
145
- t.end();
146
- });
147
-
148
- test('Domain/Iterator/IterablePair - Polygon with Feature', (t) => {
149
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(polygon), new SimpleGeometryIterator(feature));
150
- const expanded = [...iterator];
151
- const expected = [
152
- [polygon, linestring],
153
- ];
154
-
155
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
156
-
157
- let index = 0;
158
- for (const combo of iterator) {
159
- const expect = expected[index++];
160
-
161
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
162
- }
163
-
164
- t.end();
165
- });
166
-
167
- test('Domain/Iterator/IterablePair - GeometryCollection with FeatureCollection', (t) => {
168
- const iterator = new IterablePairIterator(new SimpleGeometryIterator(geometrycollection), new SimpleGeometryIterator(featurecollection));
169
- const expanded = [...iterator];
170
- const expected = [
171
- [point, { type: 'LineString', coordinates: [[5, 5], [6, 6]] }],
172
- [point, { type: 'LineString', coordinates: [[7, 7], [8, 8]] }],
173
- [point, { type: 'LineString', coordinates: [[9, 9], [10, 10]] }],
174
- [point, polygon],
175
- [point, { type: 'Polygon', coordinates: [[[4, 4], [4, 5], [5, 5], [5, 4], [4, 4]]] }],
176
- [point, { type: 'Polygon', coordinates: [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]] }],
177
-
178
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[5, 5], [6, 6]] }],
179
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[7, 7], [8, 8]] }],
180
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'LineString', coordinates: [[9, 9], [10, 10]] }],
181
- [{ type: 'Point', coordinates: [1, 1] }, polygon],
182
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'Polygon', coordinates: [[[4, 4], [4, 5], [5, 5], [5, 4], [4, 4]]] }],
183
- [{ type: 'Point', coordinates: [1, 1] }, { type: 'Polygon', coordinates: [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]] }],
184
-
185
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[5, 5], [6, 6]] }],
186
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[7, 7], [8, 8]] }],
187
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'LineString', coordinates: [[9, 9], [10, 10]] }],
188
- [{ type: 'Point', coordinates: [2, 2] }, polygon],
189
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'Polygon', coordinates: [[[4, 4], [4, 5], [5, 5], [5, 4], [4, 4]]] }],
190
- [{ type: 'Point', coordinates: [2, 2] }, { type: 'Polygon', coordinates: [[[0, 0], [0, 3], [3, 3], [3, 0], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]] }],
191
- ];
192
-
193
- t.equal(expanded.length, expected.length, `has ${expected.length} combinations`);
194
-
195
- let index = 0;
196
- for (const combo of iterator) {
197
- const expect = expected[index++];
198
-
199
- t.deepEqual(combo, expect, `combination is ${explain(expect[0])} with ${explain(expect[1])}`);
200
- }
201
-
202
- t.end();
203
- });