@saber-usa/node-common 1.7.14 → 1.7.16-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/README.md CHANGED
@@ -10,4 +10,4 @@ AGPLv3
10
10
  1. Increment the version in `package.json`
11
11
  2. Check you are logged in to npm using `npm whoami`
12
12
  3. You may need to login using `npm login` note your npm user must have 2FA enabled (in your profile)
13
- 4. Run `npm install` then `npm publish`
13
+ 4. Run `npm install` `npm login` then `npm publish`
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@saber-usa/node-common",
3
- "version": "1.7.14",
3
+ "version": "1.7.16-alpha.1",
4
4
  "description": "Common node functions for Saber",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "lint": "eslint . --ext js",
9
- "lint:fix": "eslint . --ext js --fix",
8
+ "lint": "eslint .",
9
+ "lint:fix": "eslint . --fix",
10
10
  "test": "jest --no-coverage --silent",
11
11
  "test:unit": "jest --coverage --runInBand --no-watch",
12
12
  "sonar": "node --experimental-vm-modules sonar-project.js"
@@ -17,31 +17,33 @@
17
17
  "author": "Saber USA",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@aws-sdk/client-s3": "^3.666.0",
20
+ "@aws-sdk/client-s3": "^3.1023.0",
21
21
  "date-fns": "^4.1.0",
22
- "lodash": "4.17.23",
23
- "mathjs": "^14.7.0",
22
+ "lodash": "4.18.1",
23
+ "mathjs": "^15.1.1",
24
24
  "pious-squid": "^2.3.0",
25
25
  "plotly": "^1.0.6",
26
- "satellite.js": "^6.0.1",
26
+ "satellite.js": "^6.0.2",
27
27
  "solar-calculator": "^0.3.0",
28
- "three": "^0.178.0",
29
- "winston": "3.3.3"
28
+ "three": "^0.183.2",
29
+ "winston": "3.19.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@babel/core": "7.23.0",
33
- "@babel/eslint-parser": "^7.23.0",
34
33
  "@babel/plugin-transform-modules-commonjs": "7.23.0",
34
+ "@eslint/js": "^10.0.1",
35
35
  "@jest/globals": "27.4.4",
36
- "eslint-config-google": "0.14.0",
37
- "eslint-plugin-jest": "25.3.0",
36
+ "eslint": "^10.1.0",
37
+ "eslint-plugin-jest": "^29.15.1",
38
+ "globals": "^16.5.0",
38
39
  "jest": "29.7.0",
39
40
  "jest-diff": "29.7.0",
40
41
  "nodemon": "3.1.4",
41
42
  "sonarqube-scanner": "3.0.1"
42
43
  },
43
44
  "overrides": {
44
- "braces": "3.0.3"
45
+ "braces": "3.0.3",
46
+ "lodash": "4.18.1"
45
47
  },
46
48
  "babel": {
47
49
  "plugins": [
@@ -291,8 +291,8 @@ class FrameConverter {
291
291
 
292
292
  let az = Math.atan2(sinBeta, cosBeta);
293
293
  // Wrap to [0, 2π]
294
- while (az < 0) az += Constants.TwoPi;
295
- while (az >= Constants.TwoPi) az -= Constants.TwoPi;
294
+ while (az < 0) {az += Constants.TwoPi;}
295
+ while (az >= Constants.TwoPi) {az -= Constants.TwoPi;}
296
296
 
297
297
  // Rates
298
298
  if (v !== null) {
@@ -719,7 +719,7 @@ class FrameConverter {
719
719
  const t = new TimeConverter(utc);
720
720
  const ttt = t.JulianCenturiesTT;
721
721
 
722
- let eqeTemp = Matrix3D.zeros();
722
+ let eqeTemp;
723
723
  let eqeg;
724
724
 
725
725
  const prec = this.precessionFk5(ttt);
package/src/LLA.js CHANGED
@@ -72,8 +72,8 @@ class LLA {
72
72
 
73
73
  // Wrap longitude to ±180° (half revolution)
74
74
  let lon = this.Longitude.Degrees;
75
- while (lon > 180) lon -= 360;
76
- while (lon < -180) lon += 360;
75
+ while (lon > 180) {lon -= 360;}
76
+ while (lon < -180) {lon += 360;}
77
77
  this.Longitude = new Angle(lon);
78
78
  }
79
79
 
@@ -113,7 +113,7 @@ class LaunchNominalClass {
113
113
  };
114
114
 
115
115
  // Create initial propagator
116
- let propagator = null;
116
+ let propagator;
117
117
 
118
118
  for (let i = 1; i <= maxIter; i++) {
119
119
  if (inclinationDelta > inclinationThreshold) {
@@ -408,11 +408,10 @@ class LaunchNominalClass {
408
408
  static hohmannTransferWithIncZeroing(state0, targetSMA,
409
409
  burnAtNodes = 1, mu = MU / 1e9) {
410
410
  let t0 = state0.epochUtc;
411
- let i = null;
412
411
 
413
412
  const prop = new BallisticPropagator(state0);
414
413
 
415
- for (i = 1; i <= burnAtNodes; i++) {
414
+ for (let i = 1; i <= burnAtNodes; i++) {
416
415
  const temp = prop.propagate(new Date(t0.getTime() + 1 * 1000));
417
416
  t0 = this.#getNextNodeCrossingGeoOrbit(temp);
418
417
  // here
@@ -478,7 +477,7 @@ class LaunchNominalClass {
478
477
  [state0.velocity.x, state0.velocity.y, state0.velocity.z]);
479
478
  const hUnit = h.map((component) => component / norm(h));
480
479
  const node = cross([0, 0, 1], h);
481
- let argLat = null;
480
+ let argLat;
482
481
 
483
482
  function getAngleAligned(v1, v2, vN, rightHand) {
484
483
  if (rightHand) {
@@ -640,8 +639,8 @@ class LaunchNominalClass {
640
639
  Math.pow(orbit1.semiMajorAxis, 3) / muEarth)
641
640
  * (2 * k2 * Math.PI + (e2 - orbit1.eccentricity * Math.sin(e2))
642
641
  - (e0 - orbit1.eccentricity * Math.sin(e0)));
643
- let first = null;
644
- let second = null;
642
+ let first;
643
+ let second;
645
644
 
646
645
  if (dt2 > dt1) {
647
646
  first = new Date(sv1.epochUtc.getTime() + dt1 * 1000);
package/src/OrbitUtils.js CHANGED
@@ -62,7 +62,7 @@ class OrbitUtils {
62
62
  * @return {number} Period in seconds
63
63
  */
64
64
  static getPeriod(a, mu = EARTH_MU_KM) {
65
- if (a <= 0) return null;
65
+ if (a <= 0) {return null;}
66
66
  return 2 * Math.PI * Math.sqrt(Math.pow(a, 3) / mu);
67
67
  }
68
68
 
@@ -177,7 +177,7 @@ class OrbitUtils {
177
177
  q = (c - b) * (fa - fc);
178
178
  p = (c - b) * q - (c - a) * r1;
179
179
  q = 2.0 * (q - r1);
180
- if (q > 0.0) p = -p;
180
+ if (q > 0.0) {p = -p;}
181
181
  q = Math.abs(q);
182
182
  min1 = 3.0 * q * Math.abs(xm);
183
183
  min2 = Math.abs(e * q);
@@ -313,8 +313,8 @@ class OrbitUtils {
313
313
  const rLength = norm(r);
314
314
  const vLength = norm(v);
315
315
 
316
- if (rLength === 0) throw new Error("Position vector must not be zero.");
317
- if (vLength === 0) throw new Error("Velocity vector must not be zero.");
316
+ if (rLength === 0) {throw new Error("Position vector must not be zero.");}
317
+ if (vLength === 0) {throw new Error("Velocity vector must not be zero.");}
318
318
 
319
319
  // Eccentricity vector calculation (corrected formula)
320
320
  const vLengthSq = vLength * vLength;
@@ -329,7 +329,7 @@ class OrbitUtils {
329
329
 
330
330
  const zeta = 0.5 * vLengthSq - muOverR;
331
331
 
332
- if (zeta === 0) throw new Error("Zeta cannot be zero.");
332
+ if (zeta === 0) {throw new Error("Zeta cannot be zero.");}
333
333
 
334
334
  const eLength = norm(e);
335
335
  if (Math.abs(1.0 - eLength) <= tol) {
@@ -369,13 +369,13 @@ class OrbitUtils {
369
369
  }
370
370
 
371
371
  raan = Math.acos(n[0] / nLength);
372
- if (n[1] < 0) raan = 2 * Math.PI - raan;
372
+ if (n[1] < 0) {raan = 2 * Math.PI - raan;}
373
373
 
374
374
  w = Math.acos(dot(n, e) / (nLength * eLength));
375
- if (e[2] < 0) w = 2 * Math.PI - w;
375
+ if (e[2] < 0) {w = 2 * Math.PI - w;}
376
376
 
377
377
  f = Math.acos(clamp(dot(e, r) / (eLength * rLength), -1, 1));
378
- if (rvDot < 0) f = 2 * Math.PI - f;
378
+ if (rvDot < 0) {f = 2 * Math.PI - f;}
379
379
  } else if (eLength >= 1e-11 && (i < 1e-11 || i > Math.PI - 1e-11)) { // CASE 2: Non-circular, Equatorial Orbit
380
380
  if (eLength === 0.0) {
381
381
  throw new Error(`Cannot convert from Cartesian to Keplerian
@@ -383,35 +383,35 @@ class OrbitUtils {
383
383
  }
384
384
  raan = 0;
385
385
  w = Math.acos(e[0] / eLength);
386
- if (e[1] < 0) w = 2 * Math.PI - w;
386
+ if (e[1] < 0) {w = 2 * Math.PI - w;}
387
387
 
388
388
  // For GMT-4446 fix (LOJ: 2014.03.21)
389
- if (i > Math.PI - 1e-11) w *= -1.0;
390
- if (w < 0.0) w += 2 * Math.PI;
389
+ if (i > Math.PI - 1e-11) {w *= -1.0;}
390
+ if (w < 0.0) {w += 2 * Math.PI;}
391
391
 
392
392
  f = Math.acos(clamp(dot(e, r) / (eLength * rLength), -1, 1));
393
- if (rvDot < 0) f = 2 * Math.PI - f;
393
+ if (rvDot < 0) {f = 2 * Math.PI - f;}
394
394
  } else if (eLength < 1e-11 && i >= 1e-11 && i <= Math.PI - 1e-11) { // CASE 3: Circular, Inclined Orbit
395
395
  if (nLength === 0.0) {
396
396
  throw new Error("Cannot convert from Cartesian to Keplerian "
397
397
  + "- line-of-nodes vector is a zero vector.");
398
398
  }
399
399
  raan = Math.acos(n[0] / nLength);
400
- if (n[1] < 0) raan = 2 * Math.PI - raan;
400
+ if (n[1] < 0) {raan = 2 * Math.PI - raan;}
401
401
 
402
402
  w = 0;
403
403
 
404
404
  f = Math.acos(clamp(dot(n, r) / (nLength * rLength), -1, 1));
405
- if (r[2] < 0) f = 2 * Math.PI - f;
405
+ if (r[2] < 0) {f = 2 * Math.PI - f;}
406
406
  } else if (eLength < 1e-11 && (i < 1e-11 || i > Math.PI - 1e-11)) { // CASE 4: Circular, Equatorial Orbit
407
407
  raan = 0;
408
408
  w = 0;
409
409
  f = Math.acos(clamp(r[0] / rLength, -1, 1));
410
- if (r[1] < 0) f = 2 * Math.PI - f;
410
+ if (r[1] < 0) {f = 2 * Math.PI - f;}
411
411
 
412
412
  // For GMT-4446 fix (LOJ: 2014.03.21)
413
- if (i > Math.PI - 1e-11) f *= -1.0;
414
- if (f < 0.0) f += 2 * Math.PI;
413
+ if (i > Math.PI - 1e-11) {f *= -1.0;}
414
+ if (f < 0.0) {f += 2 * Math.PI;}
415
415
  }
416
416
 
417
417
  // Calculate additional orbital parameters
package/src/astro.js CHANGED
@@ -509,9 +509,9 @@ const planeChangeDeltaV = (pv1, pv2) => {
509
509
  // The Along-track component. We need to perform this slight retrograde burn
510
510
  // in order to cancel out the eccentricity a pure cross-track burn
511
511
  // would introduce.
512
- let dvI = 0;
512
+ let dvI;
513
513
  // The Cross-track component
514
- let dvC = 0;
514
+ let dvC;
515
515
 
516
516
  // If sat 1 is higer inc than sat2
517
517
  if (el.i >= el2.i) {
@@ -620,9 +620,9 @@ const planeChangePureInclinationDeltaV = (pv1, pv2)=>{
620
620
  // The Along-track component. We need to perform this slight retrograde burn
621
621
  // in order to cancel out the eccentricity a pure cross-track burn
622
622
  // would introduce.
623
- let dvI = 0;
623
+ let dvI;
624
624
  // The Cross-track component
625
- let dvC = 0;
625
+ let dvC;
626
626
 
627
627
  // 5. Compute the cross-track and along-track burn components in the satellite's
628
628
  // RSW frame (Radial, Along-Track, Cross-track)
@@ -789,7 +789,7 @@ const propGeodetic = (elset, start, end, stepMs = 60000) => {
789
789
  const sat = twoline2satrec(elset.Line1, elset.Line2);
790
790
  for (let t = start; t <= end; t = t + stepMs) {
791
791
  const pv = propagate(sat, new Date(t));
792
- if (!isDefined(pv.position)) return [];
792
+ if (!isDefined(pv.position)) {return [];}
793
793
  const gmst = gstime(new Date(t));
794
794
  const positionGd = eciToGeodetic(pv.position, gmst);
795
795
  positions.push({lat: positionGd.latitude*RAD2DEG, lon: positionGd.longitude*RAD2DEG, t: t});
@@ -892,9 +892,9 @@ const getTRIC = (pEphem, tEphem) => {
892
892
  };
893
893
  const cartToRICMatrix = cartesianToRIC(prim.p, prim.v);
894
894
  const ricP = multiplyVector(deltaR, cartToRICMatrix);
895
- r.push(Math.round(ricP.x * 10000) / 10000);
896
- i.push(Math.round(ricP.y * 10000) / 10000);
897
- c.push(Math.round(ricP.z * 10000) / 10000);
895
+ r.push(-1 * Math.round(ricP.x * 10000) / 10000);
896
+ i.push(-1 * Math.round(ricP.y * 10000) / 10000);
897
+ c.push(-1 * Math.round(ricP.z * 10000) / 10000);
898
898
 
899
899
  const time = new Date(prim.t);
900
900
  s.push(
@@ -1068,7 +1068,7 @@ const estimateSlantRange = (obTime, ra, dec, senLat, senLon, senAltKm) => {
1068
1068
  }
1069
1069
 
1070
1070
  // A very rough initial guess, akso initialization
1071
- let range = 35786;
1071
+ let range;
1072
1072
 
1073
1073
  // Convert ra/dec to rectangular coordinates.
1074
1074
  // It is assumed that ra/dec is topocentric, non-null, and well defined.
@@ -1472,8 +1472,8 @@ const cartesianToKeplerian = (r, v) => {
1472
1472
  const K = [0, 0, 1];
1473
1473
  const n = cross(K, h);
1474
1474
 
1475
- if (norm(r, 2) === 0) throw new Error("Position vector must not be zero.");
1476
- if (norm(v, 2) === 0) throw new Error("Velocity vector must not be zero.");
1475
+ if (norm(r, 2) === 0) {throw new Error("Position vector must not be zero.");}
1476
+ if (norm(v, 2) === 0) {throw new Error("Velocity vector must not be zero.");}
1477
1477
 
1478
1478
  const e = multiply(
1479
1479
  (1 / mu),
@@ -1484,7 +1484,7 @@ const cartesianToKeplerian = (r, v) => {
1484
1484
 
1485
1485
  const zeta = 0.5 * Math.pow(norm(v), 2) - (mu / norm(r));
1486
1486
 
1487
- if (zeta === 0) throw new Error("Zeta cannot be zero.");
1487
+ if (zeta === 0) {throw new Error("Zeta cannot be zero.");}
1488
1488
  if (Math.abs(1.0 - norm(e)) <= tol) {
1489
1489
  throw new Error("Parabolic orbit conversion is not supported.");
1490
1490
  }
@@ -1514,13 +1514,13 @@ const cartesianToKeplerian = (r, v) => {
1514
1514
  }
1515
1515
 
1516
1516
  raan = Math.acos(n[0] / norm(n));
1517
- if (n[1] < 0) raan = 2 * Math.PI - raan;
1517
+ if (n[1] < 0) {raan = 2 * Math.PI - raan;}
1518
1518
 
1519
1519
  w = Math.acos(dot(n, e) / (norm(n) * norm(e)));
1520
- if (e[2] < 0) w = (2 * Math.PI) - w;
1520
+ if (e[2] < 0) {w = (2 * Math.PI) - w;}
1521
1521
 
1522
1522
  f = Math.acos(dot(e, r) / (norm(e) * norm(r)));
1523
- if (dot(r, v) < 0) f = 2 * Math.PI - f;
1523
+ if (dot(r, v) < 0) {f = 2 * Math.PI - f;}
1524
1524
  }
1525
1525
  // CASE 2: Non-circular, Equatorial Orbit
1526
1526
  if (norm(e) >= 1E-11 && (i < 1E-11 || i > Math.PI - 1E-11)) {
@@ -1569,10 +1569,10 @@ const cartesianToKeplerian = (r, v) => {
1569
1569
  raan = 0;
1570
1570
  w = 0;
1571
1571
  f = Math.acos(r[0] / norm(r));
1572
- if (r[1] < 0) f = 2 * Math.PI - f;
1572
+ if (r[1] < 0) {f = 2 * Math.PI - f;}
1573
1573
 
1574
1574
  // For GMT-4446 fix (LOJ: 2014.03.21)
1575
- if (i > Math.PI - 1E-11) f *= -1.0;
1575
+ if (i > Math.PI - 1E-11) {f *= -1.0;}
1576
1576
  if (f < 0.0) {
1577
1577
  f += 2 * Math.PI;
1578
1578
  }
@@ -1718,7 +1718,7 @@ const cartesianToElsetElements = (pv, epoch) => {
1718
1718
  const getLeoRpoData = (line1, line2, sats, startTime, endTime) => {
1719
1719
  const results = [];
1720
1720
  const pSatRec = checkTle(line1, line2);
1721
- if (!isDefined(pSatRec)) return results;
1721
+ if (!isDefined(pSatRec)) {return results;}
1722
1722
 
1723
1723
  const start = new Date(startTime).getTime();
1724
1724
  const end = new Date(endTime).getTime();
@@ -1727,7 +1727,7 @@ const getLeoRpoData = (line1, line2, sats, startTime, endTime) => {
1727
1727
  Line2: line2,
1728
1728
  };
1729
1729
  const pEphem = prop(pElset, start, end, 10000);
1730
- if (pEphem.length === 0) return results; // Primary may have re-entered the atmosphere
1730
+ if (pEphem.length === 0) {return results;} // Primary may have re-entered the atmosphere
1731
1731
 
1732
1732
  sats.forEach( (s) => {
1733
1733
  const sEphem = prop(s, start, end, 10000);
@@ -1812,7 +1812,7 @@ const getGeoRpoData = (line1, line2, sats, startTime, endTime, lonTime) => {
1812
1812
  Line1: line1,
1813
1813
  Line2: line2,
1814
1814
  }, start, end, 60000);
1815
- if (pEphem.length === 0) return results; // Primary may have re-entered the atmosphere
1815
+ if (pEphem.length === 0) {return results;} // Primary may have re-entered the atmosphere
1816
1816
 
1817
1817
  const lonEvalTime = lonTime ? new Date(lonTime) : new Date(end);
1818
1818
 
@@ -2122,7 +2122,7 @@ const calculateGeoCrossingTimes = async (propagateBetween, start, end, stepMs =
2122
2122
  const points = await propagateBetween(startTime, endTime, stepMs);
2123
2123
 
2124
2124
  for (const pv of points) {
2125
- if (!isDefined(pv)) continue;
2125
+ if (!isDefined(pv)) {continue;}
2126
2126
  const time = pv.time;
2127
2127
 
2128
2128
  const dist = norm(posToArray(pv.position)); // distance from center of the earth, km
@@ -2202,7 +2202,7 @@ const calculateNextApogeePerigeeTimesWithPropagation
2202
2202
  }
2203
2203
 
2204
2204
  // For next apoapsis, we check the true anomaly of the reference date
2205
- let timeToNextApoapsisSecs = 0;
2205
+ let timeToNextApoapsisSecs;
2206
2206
  if (el.f >= 180.0) {
2207
2207
  // Satellite is past the apoapsis and before the next periapsis
2208
2208
  timeToNextApoapsisSecs = timeToNextPeriapsisSecs + periodSecs/2;
@@ -2798,8 +2798,8 @@ const lambertThomsonAlgorithm
2798
2798
 
2799
2799
  // ----- Lines 2-5 -----
2800
2800
  let A = dot(r1, r2) / (r1Mag * r2Mag);
2801
- if (A > 1.0) A = 1.0;
2802
- if (A < -1.0) A = -1.0;
2801
+ if (A > 1.0) {A = 1.0;}
2802
+ if (A < -1.0) {A = -1.0;}
2803
2803
  let theta = Math.acos(A); // transfer angle
2804
2804
 
2805
2805
  // ----- Lines 6-8: Determine transfer direction -----
@@ -3051,8 +3051,8 @@ const hodographVelocityAlgorithm = (r1, r2, t, v1Minus, theta, p, e, mu) => {
3051
3051
  };
3052
3052
 
3053
3053
  const wrap360 = (r) => {
3054
- if (r < 0) return r + 360;
3055
- if (r >= 360) return r - 360;
3054
+ if (r < 0) {return r + 360;}
3055
+ if (r >= 360) {return r - 360;}
3056
3056
  return r;
3057
3057
  };
3058
3058
 
@@ -3101,15 +3101,15 @@ const getRaanClosureRate = (raanPrecessionCurrent, raanPrecessionPrimary) => {
3101
3101
  const getRaanAlignTime = (raan, raanDrift, raanTarget, raanTargetDrift, currentTime) => {
3102
3102
  // imagine a circle where positive is counterclockwise
3103
3103
  const netDrift = raanDrift - raanTargetDrift; // how fast we are drifting along the circle
3104
- if (netDrift === 0) return null;
3105
- if (raan === raanTarget) return new Date(currentTime);
3104
+ if (netDrift === 0) {return null;}
3105
+ if (raan === raanTarget) {return new Date(currentTime);}
3106
3106
 
3107
3107
  let diff = raanTarget - raan; // the distance along the circle we need to drift to reach the target, might be negative or positive
3108
3108
 
3109
3109
  if (Math.sign(netDrift) !== Math.sign(diff)) {
3110
3110
  // we need to transform the distance to be in the same direction as we are drifting
3111
- if (diff < 0) diff += 360; // target is behind us, e.g. target is 10 and we are 350 (diff -340): get the other part of the circle (+20)
3112
- else diff -= 360; // diff > 0, so target is ahead of us (+20), but we are going backwards, get the other part of the circle (-340)
3111
+ if (diff < 0) {diff += 360;} // target is behind us, e.g. target is 10 and we are 350 (diff -340): get the other part of the circle (+20)
3112
+ else {diff -= 360;} // diff > 0, so target is ahead of us (+20), but we are going backwards, get the other part of the circle (-340)
3113
3113
  }
3114
3114
 
3115
3115
  // diff and netdrift signs should match now
@@ -111,7 +111,7 @@ class BallisticPropagatorUtils {
111
111
 
112
112
  let dt = t1 - t0;
113
113
  let x1 = PosVelVec.zero();
114
- let xxx = 0;
114
+ let xxx;
115
115
 
116
116
  if (Math.abs(dt) < tlimit) {
117
117
  for (let i = 0; i < 6; i++) {
@@ -138,7 +138,7 @@ class BallisticPropagatorUtils {
138
138
 
139
139
  // Initial guess
140
140
  let x = alp0 * dt;
141
- if (alp0 <= 0) x = 0.5 * dt / r0Mag;
141
+ if (alp0 <= 0) {x = 0.5 * dt / r0Mag;}
142
142
 
143
143
  let dfx = 0;
144
144
  let u1 = 0; let u2 = 0; let u3 = 0;
@@ -182,7 +182,7 @@ class BallisticPropagatorUtils {
182
182
  dx = 0.5 * x;
183
183
  }
184
184
 
185
- if (Math.abs(dx) < 1.0e-10) break;
185
+ if (Math.abs(dx) < 1.0e-10) {break;}
186
186
 
187
187
  x -= dx;
188
188
  }
@@ -229,13 +229,13 @@ class BallisticPropagatorUtils {
229
229
 
230
230
  const planet = [ae, gm, xj2, xj3];
231
231
 
232
- let x1 = PosVelVec.zero();
232
+ let x1;
233
233
 
234
234
  // Compute initial guess using Kepler solver
235
235
  const vt0 = 0;
236
236
  const vt1 = span;
237
237
 
238
- let xhat0 = 0;
238
+ let xhat0;
239
239
  const keplerResult = this.kepler1(planet, vt0, x0, vt1);
240
240
  x1 = keplerResult.x1;
241
241
  xhat0 = keplerResult.xxx;
@@ -292,7 +292,7 @@ class BallisticPropagatorUtils {
292
292
  const d0 = Math.sqrt(pin.x * pin.x + pin.y * pin.y);
293
293
  let alph0 = Math.atan2(pin.y, pin.x);
294
294
 
295
- if (alph0 < 0) alph0 = twopi + alph0;
295
+ if (alph0 < 0) {alph0 = twopi + alph0;}
296
296
 
297
297
  const r02 = d0 * d0 + pin.z * pin.z;
298
298
  const zpdelta = pin.z + delta;
@@ -343,7 +343,7 @@ class BallisticPropagatorUtils {
343
343
  a1 = (csq - gam1 * b1) / pgam1;
344
344
  const dela1 = a1 - a1p;
345
345
 
346
- if (Math.abs(dela1) < 1.0e-15) break;
346
+ if (Math.abs(dela1) < 1.0e-15) {break;}
347
347
  a1p = a1;
348
348
  }
349
349
 
@@ -370,7 +370,7 @@ class BallisticPropagatorUtils {
370
370
  s1 = (pcsgam0 - s0 * p0 * q1) / ((1 - 2 * px * p1) * p0);
371
371
  const dels1 = s1 - s1p;
372
372
 
373
- if (Math.abs(dels1) < 1.0e-15) break;
373
+ if (Math.abs(dels1) < 1.0e-15) {break;}
374
374
  s1p = s1;
375
375
  }
376
376
 
@@ -390,7 +390,8 @@ class BallisticPropagatorUtils {
390
390
  let xinc = Math.asin(q);
391
391
 
392
392
  // Check inclination quadrant - CRITICAL FIX from C#
393
- if (alph3 * Math.cos(xinc) < 0) xinc = pi - xinc;
393
+ // eslint-disable-next-line no-useless-assignment -- xinc appears unused downstream; needs manual review
394
+ if (alph3 * Math.cos(xinc) < 0) {xinc = pi - xinc;}
394
395
 
395
396
  const q2 = q * q;
396
397
  const q4 = q2 * q2;
@@ -514,11 +515,11 @@ class BallisticPropagatorUtils {
514
515
  const b23 = b22 * beta2;
515
516
  let xmm1 = Math.sqrt(1 - b12 * q2);
516
517
 
517
- if (xmm1 * alph3 < 0) xmm1 = -xmm1;
518
+ if (xmm1 * alph3 < 0) {xmm1 = -xmm1;}
518
519
 
519
520
  let xmm2 = Math.sqrt(1 - b22 * q2);
520
521
 
521
- if (xmm2 * alph3 < 0) xmm2 = -xmm2;
522
+ if (xmm2 * alph3 < 0) {xmm2 = -xmm2;}
522
523
 
523
524
  const d2 = delta / (p0 * (s1 - s0 * q1));
524
525
  const d3 = q1 + 2 * p1 * d2;
@@ -636,7 +637,7 @@ class BallisticPropagatorUtils {
636
637
  const cacs = (rho0 - rho1) * gamma / ecc + 1;
637
638
  let acs = Math.atan2(shat * smgam, cacs);
638
639
 
639
- if (acs < 0) acs = twopi + acs;
640
+ if (acs < 0) {acs = twopi + acs;}
640
641
 
641
642
  xhat = acs / smgam;
642
643
  }
@@ -648,7 +649,7 @@ class BallisticPropagatorUtils {
648
649
  const zz = gamma * chat + 1;
649
650
  xhat = Math.log(zz + Math.sqrt(zz * zz - 1)) / Math.sqrt(gamma);
650
651
 
651
- if (sqrf < 0) xhat = -xhat;
652
+ if (sqrf < 0) {xhat = -xhat;}
652
653
  }
653
654
  } else { // Parabola
654
655
  xhat = rrd;
@@ -678,7 +679,7 @@ class BallisticPropagatorUtils {
678
679
 
679
680
  let snw = Math.sin(tra);
680
681
  let cnw = Math.cos(tra);
681
- let ecccnw = ecc * cnw;
682
+ let ecccnw;
682
683
 
683
684
  // const dw1dx = (1 + ecccnw) / p;
684
685
  // const dw2dx = dw1dx * dw1dx; same case. Astrolibrary does not use this instance of dw2dx here but does so later in the code after it is redeclared
@@ -715,12 +716,12 @@ class BallisticPropagatorUtils {
715
716
  let cb1qs = cstar - b1q * sstar;
716
717
  let psi1 = Math.atan(xmm1 * sstar / cb1qs);
717
718
 
718
- if (cb1qs * Math.cos(psi1) < 0.0) psi1 = pi + psi1;
719
+ if (cb1qs * Math.cos(psi1) < 0.0) {psi1 = pi + psi1;}
719
720
 
720
721
  let cb2qs = cstar - b2q * sstar;
721
722
  let psi2 = Math.atan(xmm2 * sstar / cb2qs);
722
723
 
723
- if (cb2qs * Math.cos(psi2) < 0.0) psi2 = pi + psi2;
724
+ if (cb2qs * Math.cos(psi2) < 0.0) {psi2 = pi + psi2;}
724
725
 
725
726
  let r3 = cr31 * w2 + cr32 * w3 + cr33 * w4 + cr34 * w5 + cr35 * w6;
726
727
 
@@ -846,7 +847,7 @@ class BallisticPropagatorUtils {
846
847
 
847
848
  xhat -= delx;
848
849
 
849
- if (Math.abs(delx) < 1.0e-14) break;
850
+ if (Math.abs(delx) < 1.0e-14) {break;}
850
851
  }
851
852
 
852
853
  // ========== STEP 7: Final coordinate transformation ==========
@@ -858,12 +859,12 @@ class BallisticPropagatorUtils {
858
859
  cb1qs = cstar - b1q * sstar;
859
860
  psi1 = Math.atan(xmm1 * sstar / cb1qs);
860
861
 
861
- if (cb1qs * Math.cos(psi1) < 0) psi1 = pi + psi1;
862
+ if (cb1qs * Math.cos(psi1) < 0) {psi1 = pi + psi1;}
862
863
 
863
864
  cb2qs = cstar - b2q * sstar;
864
865
  psi2 = Math.atan(xmm2 * sstar / cb2qs);
865
866
 
866
- if (cb2qs * Math.cos(psi2) < 0) psi2 = pi + psi2;
867
+ if (cb2qs * Math.cos(psi2) < 0) {psi2 = pi + psi2;}
867
868
 
868
869
  r3 = cr31 * w2 + cr32 * w3 + cr33 * w4 + cr34 * w5 + cr35 * w6;
869
870
  en3 = d10 * psi1
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  const _ = require("lodash");
2
3
  const {resolve4} = require("dns").promises;
3
4
 
@@ -36,7 +36,7 @@ const notamToCoordArray = (notam) => {
36
36
  const decimalLon = convertToDecimal(lon);
37
37
  coordArray.push([decimalLat, decimalLon]);
38
38
  }
39
- if (matchFound) break; // Stop iterating through patterns if a match is found
39
+ if (matchFound) {break;} // Stop iterating through patterns if a match is found
40
40
  }
41
41
 
42
42
  return coordArray;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  const winston = require("winston");
2
3
  const {
3
4
  createLogger,
@@ -45,7 +46,7 @@ module.exports.loggerFactory = ({
45
46
  format: format.combine(
46
47
  format.errors({stack: true}),
47
48
  format.cli(),
48
- // eslint-disable-next-line max-len
49
+
49
50
  format.printf(({
50
51
  level,
51
52
  message,
@@ -95,4 +96,4 @@ module.exports.loggerFactory = ({
95
96
  ...additionalData,
96
97
  nameSpace: nameSpace,
97
98
  });
98
- }
99
+ };
package/src/udl.js CHANGED
@@ -198,12 +198,12 @@ const enrichGeoLon = (npsOb, enrichedFields) => {
198
198
  npsOb.GeoLat = geodetic.Latitude;
199
199
 
200
200
  if (typeof slantRange === "number" && !isNaN(slantRange)) {
201
- if (!npsOb.Range && !npsOb.GeoRange) enrichedFields.push("GeoRange");
201
+ if (!npsOb.Range && !npsOb.GeoRange) {enrichedFields.push("GeoRange");}
202
202
  npsOb.GeoRange = slantRange;
203
203
  }
204
204
 
205
- if (npsOb.GeoLon) enrichedFields.push("GeoLon");
206
- if (npsOb.GeoLat) enrichedFields.push("GeoLat");
205
+ if (npsOb.GeoLon) {enrichedFields.push("GeoLon");}
206
+ if (npsOb.GeoLat) {enrichedFields.push("GeoLat");}
207
207
  return enrichedFields;
208
208
  };
209
209