proj4 2.17.0 → 2.19.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 (154) hide show
  1. package/bower.json +1 -1
  2. package/component.json +1 -1
  3. package/dist/lib/Point.d.ts +24 -0
  4. package/dist/lib/Proj.d.ts +71 -0
  5. package/dist/lib/adjust_axis.d.ts +1 -0
  6. package/dist/lib/checkSanity.d.ts +1 -0
  7. package/dist/lib/common/acosh.d.ts +1 -0
  8. package/dist/lib/common/adjust_lat.d.ts +1 -0
  9. package/dist/lib/common/adjust_lon.d.ts +1 -0
  10. package/dist/lib/common/adjust_zone.d.ts +1 -0
  11. package/dist/lib/common/asinh.d.ts +1 -0
  12. package/dist/lib/common/asinhy.d.ts +1 -0
  13. package/dist/lib/common/asinz.d.ts +1 -0
  14. package/dist/lib/common/atanh.d.ts +1 -0
  15. package/dist/lib/common/clens.d.ts +1 -0
  16. package/dist/lib/common/clens_cmplx.d.ts +1 -0
  17. package/dist/lib/common/cosh.d.ts +1 -0
  18. package/dist/lib/common/e0fn.d.ts +1 -0
  19. package/dist/lib/common/e1fn.d.ts +1 -0
  20. package/dist/lib/common/e2fn.d.ts +1 -0
  21. package/dist/lib/common/e3fn.d.ts +1 -0
  22. package/dist/lib/common/fL.d.ts +1 -0
  23. package/dist/lib/common/gN.d.ts +1 -0
  24. package/dist/lib/common/gatg.d.ts +1 -0
  25. package/dist/lib/common/hypot.d.ts +1 -0
  26. package/dist/lib/common/imlfn.d.ts +1 -0
  27. package/dist/lib/common/invlatiso.d.ts +1 -0
  28. package/dist/lib/common/iqsfnz.d.ts +1 -0
  29. package/dist/lib/common/latiso.d.ts +1 -0
  30. package/dist/lib/common/log1py.d.ts +1 -0
  31. package/dist/lib/common/mlfn.d.ts +1 -0
  32. package/dist/lib/common/msfnz.d.ts +1 -0
  33. package/dist/lib/common/phi2z.d.ts +1 -0
  34. package/dist/lib/common/pj_enfn.d.ts +1 -0
  35. package/dist/lib/common/pj_inv_mlfn.d.ts +1 -0
  36. package/dist/lib/common/pj_mlfn.d.ts +1 -0
  37. package/dist/lib/common/qsfnz.d.ts +1 -0
  38. package/dist/lib/common/sign.d.ts +1 -0
  39. package/dist/lib/common/sinh.d.ts +1 -0
  40. package/dist/lib/common/srat.d.ts +1 -0
  41. package/dist/lib/common/tanh.d.ts +1 -0
  42. package/dist/lib/common/toPoint.d.ts +5 -0
  43. package/dist/lib/common/tsfnz.d.ts +1 -0
  44. package/dist/lib/common/vincenty.d.ts +35 -0
  45. package/dist/lib/constants/Datum.d.ts +1715 -0
  46. package/dist/lib/constants/Ellipsoid.d.ts +353 -0
  47. package/dist/lib/constants/PrimeMeridian.d.ts +16 -0
  48. package/dist/lib/constants/units.d.ts +63 -0
  49. package/dist/lib/constants/values.d.ts +19 -0
  50. package/dist/lib/core.d.ts +117 -0
  51. package/dist/lib/datum.d.ts +10 -0
  52. package/dist/lib/datumUtils.d.ts +28 -0
  53. package/dist/lib/datum_transform.d.ts +2 -0
  54. package/dist/lib/defs.d.ts +57 -0
  55. package/dist/lib/deriveConstants.d.ts +11 -0
  56. package/dist/lib/extend.d.ts +1 -0
  57. package/dist/lib/global.d.ts +1 -0
  58. package/dist/lib/includedProjections.d.ts +1 -0
  59. package/dist/lib/index.d.ts +24 -0
  60. package/dist/lib/match.d.ts +1 -0
  61. package/dist/lib/nadgrid.d.ts +107 -0
  62. package/dist/lib/parseCode.d.ts +6 -0
  63. package/dist/lib/projString.d.ts +5 -0
  64. package/dist/lib/projections/aea.d.ts +83 -0
  65. package/dist/lib/projections/aeqd.d.ts +32 -0
  66. package/dist/lib/projections/bonne.d.ts +27 -0
  67. package/dist/lib/projections/cass.d.ts +36 -0
  68. package/dist/lib/projections/cea.d.ts +28 -0
  69. package/dist/lib/projections/eqc.d.ts +20 -0
  70. package/dist/lib/projections/eqdc.d.ts +71 -0
  71. package/dist/lib/projections/eqearth.d.ts +15 -0
  72. package/dist/lib/projections/equi.d.ts +40 -0
  73. package/dist/lib/projections/etmerc.d.ts +45 -0
  74. package/dist/lib/projections/gauss.d.ts +38 -0
  75. package/dist/lib/projections/geocent.d.ts +22 -0
  76. package/dist/lib/projections/geos.d.ts +51 -0
  77. package/dist/lib/projections/gnom.d.ts +37 -0
  78. package/dist/lib/projections/gstmerc.d.ts +41 -0
  79. package/dist/lib/projections/krovak.d.ts +34 -0
  80. package/dist/lib/projections/laea.d.ts +70 -0
  81. package/dist/lib/projections/lcc.d.ts +36 -0
  82. package/dist/lib/projections/longlat.d.ts +11 -0
  83. package/dist/lib/projections/merc.d.ts +30 -0
  84. package/dist/lib/projections/mill.d.ts +11 -0
  85. package/dist/lib/projections/moll.d.ts +11 -0
  86. package/dist/lib/projections/nzmg.d.ts +33 -0
  87. package/dist/lib/projections/omerc.d.ts +60 -0
  88. package/dist/lib/projections/ortho.d.ts +25 -0
  89. package/dist/lib/projections/poly.d.ts +32 -0
  90. package/dist/lib/projections/qsc.d.ts +31 -0
  91. package/dist/lib/projections/robin.d.ts +24 -0
  92. package/dist/lib/projections/sinu.d.ts +37 -0
  93. package/dist/lib/projections/somerc.d.ts +35 -0
  94. package/dist/lib/projections/stere.d.ts +52 -0
  95. package/dist/lib/projections/sterea.d.ts +33 -0
  96. package/dist/lib/projections/tmerc.d.ts +38 -0
  97. package/dist/lib/projections/tpers.d.ts +45 -0
  98. package/dist/lib/projections/utm.d.ts +19 -0
  99. package/dist/lib/projections/vandg.d.ts +28 -0
  100. package/dist/lib/projections.d.ts +10 -0
  101. package/dist/lib/transform.d.ts +8 -0
  102. package/dist/proj4-src.js +847 -247
  103. package/dist/proj4.js +1 -1
  104. package/dist/projs.d.ts +1 -0
  105. package/lib/Point.js +9 -3
  106. package/lib/Proj.js +25 -1
  107. package/lib/adjust_axis.js +1 -0
  108. package/lib/common/toPoint.js +4 -0
  109. package/lib/common/vincenty.js +123 -0
  110. package/lib/constants/PrimeMeridian.js +16 -15
  111. package/lib/core.js +152 -16
  112. package/lib/defs.js +65 -5
  113. package/lib/index.js +17 -11
  114. package/lib/nadgrid.js +70 -0
  115. package/lib/parseCode.js +5 -1
  116. package/lib/projString.js +6 -0
  117. package/lib/projections/aea.js +25 -0
  118. package/lib/projections/aeqd.js +22 -26
  119. package/lib/projections/bonne.js +11 -0
  120. package/lib/projections/cass.js +11 -0
  121. package/lib/projections/cea.js +7 -1
  122. package/lib/projections/eqdc.js +29 -7
  123. package/lib/projections/equi.js +11 -2
  124. package/lib/projections/etmerc.js +12 -0
  125. package/lib/projections/gauss.js +12 -0
  126. package/lib/projections/geos.js +16 -0
  127. package/lib/projections/gnom.js +11 -2
  128. package/lib/projections/gstmerc.js +12 -0
  129. package/lib/projections/laea.js +30 -11
  130. package/lib/projections/lcc.js +10 -0
  131. package/lib/projections/merc.js +9 -0
  132. package/lib/projections/omerc.js +29 -4
  133. package/lib/projections/ortho.js +7 -0
  134. package/lib/projections/poly.js +14 -0
  135. package/lib/projections/qsc.js +11 -0
  136. package/lib/projections/sinu.js +11 -0
  137. package/lib/projections/somerc.js +10 -0
  138. package/lib/projections/stere.js +16 -2
  139. package/lib/projections/sterea.js +10 -0
  140. package/lib/projections/tmerc.js +8 -0
  141. package/lib/projections/tpers.js +24 -3
  142. package/lib/projections/utm.js +1 -0
  143. package/lib/projections/vandg.js +9 -2
  144. package/lib/transform.js +9 -0
  145. package/package.json +8 -6
  146. package/tsconfig.json +14 -0
  147. package/.github/workflows/build-and-test.yml +0 -69
  148. package/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
  149. package/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
  150. package/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
  151. package/.nyc_output/processinfo/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
  152. package/.nyc_output/processinfo/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
  153. package/.nyc_output/processinfo/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
  154. package/.nyc_output/processinfo/index.json +0 -1
@@ -4,6 +4,29 @@ import phi2z from '../common/phi2z';
4
4
  import { EPSLN, HALF_PI, TWO_PI, FORTPI } from '../constants/values';
5
5
  import { getNormalizedProjName } from '../projections';
6
6
 
7
+ /**
8
+ * @typedef {Object} LocalThis
9
+ * @property {boolean} no_off
10
+ * @property {boolean} no_rot
11
+ * @property {number} rectified_grid_angle
12
+ * @property {number} es
13
+ * @property {number} A
14
+ * @property {number} B
15
+ * @property {number} E
16
+ * @property {number} e
17
+ * @property {number} lam0
18
+ * @property {number} singam
19
+ * @property {number} cosgam
20
+ * @property {number} sinrot
21
+ * @property {number} cosrot
22
+ * @property {number} rB
23
+ * @property {number} ArB
24
+ * @property {number} BrA
25
+ * @property {number} u_0
26
+ * @property {number} v_pole_n
27
+ * @property {number} v_pole_s
28
+ */
29
+
7
30
  var TOL = 1e-7;
8
31
 
9
32
  function isTypeA(P) {
@@ -13,8 +36,10 @@ function isTypeA(P) {
13
36
  return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1 || typeAProjections.indexOf(getNormalizedProjName(projectionName)) !== -1;
14
37
  }
15
38
 
16
- /* Initialize the Oblique Mercator projection
17
- ------------------------------------------ */
39
+ /**
40
+ * Initialize the Oblique Mercator projection
41
+ * @this {import('../defs.js').ProjectionDefinition & LocalThis}
42
+ */
18
43
  export function init() {
19
44
  var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,
20
45
  gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;
@@ -107,9 +132,9 @@ export function init() {
107
132
  J = (J - L * H) / (J + L * H);
108
133
  con = lam1 - lam2;
109
134
 
110
- if (con < -Math.pi) {
135
+ if (con < -Math.PI) {
111
136
  lam2 -= TWO_PI;
112
- } else if (con > Math.pi) {
137
+ } else if (con > Math.PI) {
113
138
  lam2 += TWO_PI;
114
139
  }
115
140
 
@@ -2,6 +2,13 @@ import adjust_lon from '../common/adjust_lon';
2
2
  import asinz from '../common/asinz';
3
3
  import { EPSLN, HALF_PI } from '../constants/values';
4
4
 
5
+ /**
6
+ * @typedef {Object} LocalThis
7
+ * @property {number} sin_p14
8
+ * @property {number} cos_p14
9
+ */
10
+
11
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
5
12
  export function init() {
6
13
  // double temp; /* temporary variable */
7
14
 
@@ -8,8 +8,22 @@ import mlfn from '../common/mlfn';
8
8
  import { EPSLN } from '../constants/values';
9
9
 
10
10
  import gN from '../common/gN';
11
+
12
+ /**
13
+ * @typedef {Object} LocalThis
14
+ * @property {number} temp
15
+ * @property {number} es
16
+ * @property {number} e
17
+ * @property {number} e0
18
+ * @property {number} e1
19
+ * @property {number} e2
20
+ * @property {number} e3
21
+ * @property {number} ml0
22
+ */
23
+
11
24
  var MAX_ITER = 20;
12
25
 
26
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
13
27
  export function init() {
14
28
  /* Place parameters in static storage for common use
15
29
  ------------------------------------------------- */
@@ -3,6 +3,16 @@
3
3
 
4
4
  import { EPSLN, TWO_PI, SPI, HALF_PI, FORTPI } from '../constants/values';
5
5
 
6
+ /**
7
+ * @typedef {Object} LocalThis
8
+ * @property {number} face
9
+ * @property {number} x0
10
+ * @property {number} y0
11
+ * @property {number} es
12
+ * @property {number} one_minus_f
13
+ * @property {number} one_minus_f_squared
14
+ */
15
+
6
16
  /* constants */
7
17
  var FACE_ENUM = {
8
18
  FRONT: 1,
@@ -20,6 +30,7 @@ var AREA_ENUM = {
20
30
  AREA_3: 4
21
31
  };
22
32
 
33
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
23
34
  export function init() {
24
35
  this.x0 = this.x0 || 0;
25
36
  this.y0 = this.y0 || 0;
@@ -8,6 +8,17 @@ import { EPSLN, HALF_PI } from '../constants/values';
8
8
 
9
9
  import asinz from '../common/asinz';
10
10
 
11
+ /**
12
+ * @typedef {Object} LocalThis
13
+ * @property {Array<number>} en
14
+ * @property {number} n
15
+ * @property {number} m
16
+ * @property {number} C_y
17
+ * @property {number} C_x
18
+ * @property {number} es
19
+ */
20
+
21
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
11
22
  export function init() {
12
23
  /* Place parameters in static storage for common use
13
24
  ------------------------------------------------- */
@@ -6,6 +6,16 @@
6
6
  http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
7
7
  */
8
8
 
9
+ /**
10
+ * @typedef {Object} LocalThis
11
+ * @property {number} lambda0
12
+ * @property {number} e
13
+ * @property {number} R
14
+ * @property {number} b0
15
+ * @property {number} K
16
+ */
17
+
18
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
9
19
  export function init() {
10
20
  var phy0 = this.lat0;
11
21
  this.lambda0 = this.long0;
@@ -6,11 +6,25 @@ import tsfnz from '../common/tsfnz';
6
6
  import phi2z from '../common/phi2z';
7
7
  import adjust_lon from '../common/adjust_lon';
8
8
 
9
+ /**
10
+ * @typedef {Object} LocalThis
11
+ * @property {number} coslat0
12
+ * @property {number} sinlat0
13
+ * @property {number} ms1
14
+ * @property {number} X0
15
+ * @property {number} cosX0
16
+ * @property {number} sinX0
17
+ * @property {number} con
18
+ * @property {number} cons
19
+ * @property {number} e
20
+ */
21
+
9
22
  export function ssfn_(phit, sinphi, eccen) {
10
23
  sinphi *= eccen;
11
24
  return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
12
25
  }
13
26
 
27
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
14
28
  export function init() {
15
29
  // setting default parameters
16
30
  this.x0 = this.x0 || 0;
@@ -43,7 +57,7 @@ export function init() {
43
57
  this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
44
58
  }
45
59
  this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
46
- this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
60
+ this.X0 = 2 * Math.atan(ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
47
61
  this.cosX0 = Math.cos(this.X0);
48
62
  this.sinX0 = Math.sin(this.X0);
49
63
  }
@@ -72,7 +86,7 @@ export function forward(p) {
72
86
  p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
73
87
  return p;
74
88
  } else {
75
- X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
89
+ X = 2 * Math.atan(ssfn_(lat, sinlat, this.e)) - HALF_PI;
76
90
  cosX = Math.cos(X);
77
91
  sinX = Math.sin(X);
78
92
  if (Math.abs(this.coslat0) <= EPSLN) {
@@ -2,6 +2,16 @@ import gauss from './gauss';
2
2
  import adjust_lon from '../common/adjust_lon';
3
3
  import hypot from '../common/hypot';
4
4
 
5
+ /**
6
+ * @typedef {Object} LocalThis
7
+ * @property {number} sinc0
8
+ * @property {number} cosc0
9
+ * @property {number} R2
10
+ * @property {number} rc
11
+ * @property {number} phic0
12
+ */
13
+
14
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
5
15
  export function init() {
6
16
  gauss.init.apply(this);
7
17
  if (!this.rc) {
@@ -9,6 +9,14 @@ import adjust_lon from '../common/adjust_lon';
9
9
  import { EPSLN, HALF_PI } from '../constants/values';
10
10
  import sign from '../common/sign';
11
11
 
12
+ /**
13
+ * @typedef {Object} LocalThis
14
+ * @property {number} es
15
+ * @property {Array<number>} en
16
+ * @property {number} ml0
17
+ */
18
+
19
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
12
20
  export function init() {
13
21
  this.x0 = this.x0 !== undefined ? this.x0 : 0;
14
22
  this.y0 = this.y0 !== undefined ? this.y0 : 0;
@@ -1,3 +1,26 @@
1
+ import { D2R, HALF_PI, EPSLN } from '../constants/values';
2
+ import hypot from '../common/hypot';
3
+
4
+ /**
5
+ * @typedef {Object} LocalThis
6
+ * @property {number} mode
7
+ * @property {number} sinph0
8
+ * @property {number} cosph0
9
+ * @property {number} pn1
10
+ * @property {number} h
11
+ * @property {number} rp
12
+ * @property {number} p
13
+ * @property {number} h1
14
+ * @property {number} pfact
15
+ * @property {number} es
16
+ * @property {number} tilt
17
+ * @property {number} azi
18
+ * @property {number} cg
19
+ * @property {number} sg
20
+ * @property {number} cw
21
+ * @property {number} sw
22
+ */
23
+
1
24
  var mode = {
2
25
  N_POLE: 0,
3
26
  S_POLE: 1,
@@ -5,9 +28,6 @@ var mode = {
5
28
  OBLIQ: 3
6
29
  };
7
30
 
8
- import { D2R, HALF_PI, EPSLN } from '../constants/values';
9
- import hypot from '../common/hypot';
10
-
11
31
  var params = {
12
32
  h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7
13
33
  azi: { def: 0, num: true, degrees: true }, // default is North
@@ -16,6 +36,7 @@ var params = {
16
36
  lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic
17
37
  };
18
38
 
39
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
19
40
  export function init() {
20
41
  Object.keys(params).forEach(function (p) {
21
42
  if (typeof this[p] === 'undefined') {
@@ -3,6 +3,7 @@ import etmerc from './etmerc';
3
3
  export var dependsOn = 'etmerc';
4
4
  import { D2R } from '../constants/values';
5
5
 
6
+ /** @this {import('../defs.js').ProjectionDefinition} */
6
7
  export function init() {
7
8
  var zone = adjust_zone(this.zone, this.long0);
8
9
  if (zone === undefined) {
@@ -4,8 +4,15 @@ import { HALF_PI, EPSLN } from '../constants/values';
4
4
 
5
5
  import asinz from '../common/asinz';
6
6
 
7
- /* Initialize the Van Der Grinten projection
8
- ---------------------------------------- */
7
+ /**
8
+ * @typedef {Object} LocalThis
9
+ * @property {number} R - Radius of the Earth
10
+ */
11
+
12
+ /**
13
+ * Initialize the Van Der Grinten projection
14
+ * @this {import('../defs.js').ProjectionDefinition & LocalThis}
15
+ */
9
16
  export function init() {
10
17
  // this.R = 6370997; //Radius of earth
11
18
  this.R = this.a;
package/lib/transform.js CHANGED
@@ -11,6 +11,13 @@ function checkNotWGS(source, dest) {
11
11
  || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84');
12
12
  }
13
13
 
14
+ /**
15
+ * @param {import('./defs').ProjectionDefinition} source
16
+ * @param {import('./defs').ProjectionDefinition} dest
17
+ * @param {import('./core').TemplateCoordinates} point
18
+ * @param {boolean} enforceAxis
19
+ * @returns {import('./core').InterfaceCoordinates | undefined}
20
+ */
14
21
  export default function transform(source, dest, point, enforceAxis) {
15
22
  var wgs84;
16
23
  if (Array.isArray(point)) {
@@ -67,6 +74,8 @@ export default function transform(source, dest, point, enforceAxis) {
67
74
  return;
68
75
  }
69
76
 
77
+ point = /** @type {import('./core').InterfaceCoordinates} */ (point);
78
+
70
79
  // Adjust for the prime meridian if necessary
71
80
  if (dest.from_greenwich) {
72
81
  point = {
package/package.json CHANGED
@@ -1,23 +1,25 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.17.0",
3
+ "version": "2.19.0",
4
4
  "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
5
  "homepage": "https://proj4js.github.io/proj4js/",
6
6
  "main": "dist/proj4-src.js",
7
7
  "module": "lib/index.js",
8
+ "types": "dist/lib/index.js",
8
9
  "scripts": {
9
- "prepare": "npm run build && npm run test:all",
10
+ "prepare": "npm run test",
10
11
  "build": "grunt && npm run rollup",
11
12
  "build:tmerc": "grunt build:tmerc && npm run rollup",
12
13
  "rollup": "rollup -c",
13
- "pretest": "npm run lint",
14
+ "pretest": "npm run lint && npm run types",
14
15
  "lint": "eslint *.js *.mjs scripts lib test",
15
16
  "format": "npm run lint -- --fix",
16
17
  "test": "npm run build && npm run test:all",
17
18
  "test:coverage": "nyc npm run test:ci",
18
19
  "test:all": "npm run test:ci && npm run test:browser",
19
20
  "test:browser": "node test/puppeteer-tests.mjs",
20
- "test:ci": "npx -y mocha test/test-ci.mjs --reporter dot"
21
+ "test:ci": "npx -y mocha test/test-ci.mjs --reporter dot",
22
+ "types": "tsc"
21
23
  },
22
24
  "repository": {
23
25
  "type": "git",
@@ -40,10 +42,10 @@
40
42
  "mocha": "^10.2.0",
41
43
  "nyc": "^17.1.0",
42
44
  "puppeteer": "^24.2.0",
43
- "rollup": "^4.9.6"
45
+ "rollup": "^4.9.6",
46
+ "typescript": "^5.8.3"
44
47
  },
45
48
  "dependencies": {
46
- "geographiclib-geodesic": "^2.1.1",
47
49
  "mgrs": "1.0.0",
48
50
  "wkt-parser": "^1.5.1"
49
51
  }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "checkJs": true,
5
+ "skipLibCheck": true,
6
+ "emitDeclarationOnly": true,
7
+ "declaration": true,
8
+ "declarationDir": "dist",
9
+ },
10
+ "include": [
11
+ "lib/index.d.ts",
12
+ "lib/**/*.js",
13
+ ],
14
+ }
@@ -1,69 +0,0 @@
1
- name: Node.js CI
2
-
3
- on:
4
- push:
5
- branches: [ "master" ]
6
- pull_request:
7
- branches: [ "master" ]
8
-
9
- jobs:
10
- build:
11
- name: Build and test
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v3
16
- - name: Use Node.js 22.x
17
- uses: actions/setup-node@v3
18
- with:
19
- node-version: 22.x
20
- cache: 'npm'
21
- - run: npm ci
22
- - uses: actions/upload-artifact@v4
23
- with:
24
- name: dist
25
- path: dist/
26
-
27
- test-coverage:
28
- name: Test coverage
29
- needs: build
30
- runs-on: ubuntu-latest
31
-
32
- steps:
33
- - uses: actions/checkout@v3
34
- - uses: actions/download-artifact@v4
35
- with:
36
- name: dist
37
- path: dist
38
- - name: Use Node.js 22.x
39
- uses: actions/setup-node@v3
40
- with:
41
- node-version: 22.x
42
- cache: 'npm'
43
- - run: npm install --no-save nyc chai
44
- - run: npm run test:coverage
45
-
46
-
47
- test-node:
48
- name: Test older node versions
49
- needs: build
50
- runs-on: ubuntu-latest
51
-
52
- strategy:
53
- matrix:
54
- node-version: [16.x, 18.x, 20.x]
55
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
56
-
57
- steps:
58
- - uses: actions/checkout@v3
59
- - uses: actions/download-artifact@v4
60
- with:
61
- name: dist
62
- path: dist/
63
- - name: Use Node.js ${{ matrix.node-version }}
64
- uses: actions/setup-node@v3
65
- with:
66
- node-version: ${{ matrix.node-version }}
67
- cache: 'npm'
68
- - run: npm install --no-save chai
69
- - run: npm run test:ci