@saber-usa/node-common 1.7.16 → 1.7.17

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,25 @@ 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` `npm login` then `npm publish`
13
+ 4. Run `npm install` `npm login` then `npm publish`
14
+
15
+ ## Run SonarQube Scan
16
+ To run SonarQube locally:
17
+
18
+ `docker run -d --name sonarqube -p 9000:9000 sonarqube:latest`
19
+
20
+ Go to `http://localhost:9000` (default credentials: `admin` / `admin`).
21
+
22
+ Create a local project (NPM) and generate a token.
23
+
24
+ Run a scan on this project:
25
+
26
+ ```
27
+ sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.token=<your_sonarqube_token> -Dsonar.projectKey=node-common
28
+ ```
29
+
30
+ MCP setup options:
31
+ - Cursor: set token/url in `.cursor/sonarqube.env` (used by `.cursor/mcp.json`).
32
+ - Claude Code: set token/url in `.mcp.json` (or copy from `.mcp.json.example`).
33
+
34
+ Note: for Dockerized MCP, use `http://host.docker.internal:9000` as `SONARQUBE_URL`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saber-usa/node-common",
3
- "version": "1.7.16",
3
+ "version": "1.7.17",
4
4
  "description": "Common node functions for Saber",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "lint:fix": "eslint . --fix",
13
13
  "test": "jest --no-coverage --silent",
14
14
  "test:unit": "jest --coverage --runInBand --no-watch",
15
- "sonar": "node --experimental-vm-modules sonar-project.js"
15
+ "sonar": "sonar -Dsonar.host.url=http://localhost:9000"
16
16
  },
17
17
  "files": [
18
18
  "src/**/*"
@@ -20,7 +20,7 @@
20
20
  "author": "Saber USA",
21
21
  "license": "ISC",
22
22
  "dependencies": {
23
- "@aws-sdk/client-s3": "^3.1024.0",
23
+ "@aws-sdk/client-s3": "^3.1034.0",
24
24
  "date-fns": "^4.1.0",
25
25
  "lodash": "4.18.1",
26
26
  "mathjs": "^15.2.0",
@@ -28,20 +28,20 @@
28
28
  "plotly": "^1.0.6",
29
29
  "satellite.js": "^7.0.0",
30
30
  "solar-calculator": "^0.3.0",
31
- "three": "^0.183.2",
31
+ "three": "^0.184",
32
32
  "winston": "3.19.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/preset-env": "^7.29.2",
36
36
  "@eslint/js": "^10.0.1",
37
37
  "@jest/globals": "^30.3.0",
38
- "eslint": "^10.1.0",
39
- "eslint-plugin-jest": "^29.15.1",
40
- "globals": "^16.5.0",
38
+ "@sonar/scan": "^4.3.6",
39
+ "eslint": "^10.2.1",
40
+ "eslint-plugin-jest": "^29.15.2",
41
+ "globals": "^17.5.0",
41
42
  "jest": "^30.3.0",
42
43
  "jest-diff": "^30.3.0",
43
- "nodemon": "3.1.4",
44
- "sonarqube-scanner": "3.0.1"
44
+ "nodemon": "3.1.14"
45
45
  },
46
46
  "overrides": {
47
47
  "braces": "3.0.3",
@@ -580,9 +580,9 @@ class FrameConverter {
580
580
  // https://github.com/skyfielders/python-skyfield/blob/master/skyfield/framelib.py
581
581
  // 'xi0', 'eta0', and 'da0' are ICRS frame biases in arcseconds taken
582
582
  // from IERS (2003) Conventions, Chapter 5.
583
- const xi0 = -0.0166170 * Constants.ArcsecToRad;
583
+ const xi0 = -0.016617 * Constants.ArcsecToRad;
584
584
  const eta0 = -0.0068192 * Constants.ArcsecToRad;
585
- const da0 = -0.01460 * Constants.ArcsecToRad;
585
+ const da0 = -0.0146 * Constants.ArcsecToRad;
586
586
 
587
587
  // Compute elements of rotation matrix.
588
588
  const yx = -da0;
@@ -723,7 +723,6 @@ class FrameConverter {
723
723
  let eqeg;
724
724
 
725
725
  const prec = this.precessionFk5(ttt);
726
- // const { nut } = this.nutationFk5(ttt);
727
726
  const nut = this.nutationFk5(ttt);
728
727
 
729
728
  // Rotate teme through just geometric terms
@@ -738,7 +737,6 @@ class FrameConverter {
738
737
  const temp = this.multiplyMatrices(nut.nut, eqep);
739
738
  const returnMat = this.multiplyMatrices(prec, temp);
740
739
  return returnMat;
741
- // return prec.multiply(temp);
742
740
  }
743
741
 
744
742
  /**
@@ -760,17 +758,17 @@ class FrameConverter {
760
758
  */
761
759
  static nutationFk5(ttt) {
762
760
  // Compute the mean obliquity of the ecliptic
763
- let me1980 = ((0.001813 * ttt - 0.00059) * ttt - 46.8150) * ttt + 84381.448;
761
+ let me1980 = ((0.001813 * ttt - 0.00059) * ttt - 46.815) * ttt + 84381.448;
764
762
  me1980 = me1980 / 3600 % 360;
765
763
  me1980 *= Constants.DegToRad;
766
764
 
767
765
  // Evaluate the Delaunay parameters associated with the Moon and the Sun in the interval [0,2π]°
768
766
  const oo3600 = 1 / 3600;
769
- let Mm = ((0.064 * ttt + 31.310) * ttt + 1717915922.6330) * ttt * oo3600 + 134.96298139;
770
- let Ms = (((-0.012) * ttt - 0.577) * ttt + 129596581.2240) * ttt * oo3600 + 357.52772333;
771
- let uMm = ((0.011 * ttt - 13.257) * ttt + 1739527263.1370) * ttt * oo3600 + 93.27191028;
772
- let Ds = ((0.019 * ttt - 6.891) * ttt + 1602961601.3280) * ttt * oo3600 + 297.85036306;
773
- let Omegam = ((0.008 * ttt + 7.455) * ttt - 6962890.5390) * ttt * oo3600 + 125.04452222;
767
+ let Mm = ((0.064 * ttt + 31.31) * ttt + 1717915922.633) * ttt * oo3600 + 134.96298139;
768
+ let Ms = (((-0.012) * ttt - 0.577) * ttt + 129596581.224) * ttt * oo3600 + 357.52772333;
769
+ let uMm = ((0.011 * ttt - 13.257) * ttt + 1739527263.137) * ttt * oo3600 + 93.27191028;
770
+ let Ds = ((0.019 * ttt - 6.891) * ttt + 1602961601.328) * ttt * oo3600 + 297.85036306;
771
+ let Omegam = ((0.008 * ttt + 7.455) * ttt - 6962890.539) * ttt * oo3600 + 125.04452222;
774
772
 
775
773
  Mm = Mm % 360 * Constants.DegToRad;
776
774
  Ms = Ms % 360 * Constants.DegToRad;
@@ -806,11 +804,6 @@ class FrameConverter {
806
804
  const costrueeps = Math.cos(trueObliq);
807
805
  const sintrueeps = Math.sin(trueObliq);
808
806
 
809
- // const nut = new Matrix3D(
810
- // cospsi, costrueeps * sinpsi, sintrueeps * sinpsi,
811
- // -coseps * sinpsi, costrueeps * coseps * cospsi + sintrueeps * sineps, sintrueeps * coseps * cospsi - sineps * costrueeps,
812
- // -sineps * sinpsi, costrueeps * sineps * cospsi - sintrueeps * coseps, sintrueeps * sineps * cospsi + costrueeps * coseps
813
- // );
814
807
 
815
808
  const nut = new Matrix3D(
816
809
  new Vector3D(cospsi, costrueeps * sinpsi, sintrueeps * sinpsi),
@@ -856,11 +849,6 @@ class FrameConverter {
856
849
  const sinz = Math.sin(z);
857
850
 
858
851
  // // Form matrix mod to gcrf
859
- // return new Matrix3D(
860
- // coszeta * costheta * cosz - sinzeta * sinz, coszeta * costheta * sinz + sinzeta * cosz, coszeta * sintheta,
861
- // -sinzeta * costheta * cosz - coszeta * sinz, -sinzeta * costheta * sinz + coszeta * cosz, -sinzeta * sintheta,
862
- // -sintheta * cosz, -sintheta * sinz, costheta
863
- // );
864
852
 
865
853
  return new Matrix3D(
866
854
  new Vector3D(coszeta * costheta * cosz - sinzeta * sinz,
@@ -892,16 +880,11 @@ class FrameConverter {
892
880
  + 0.000063 * Constants.SecondToRad * Math.sin(2 * raan)
893
881
  : gmst + deltapsi * Math.cos(meaneps);
894
882
 
895
- ast %= 2.0 * Math.PI;
883
+ ast %= 2 * Math.PI;
896
884
 
897
885
  const sinast = Math.sin(ast);
898
886
  const cosast = Math.cos(ast);
899
887
 
900
- // return new Matrix3D(
901
- // cosast, -sinast, 0,
902
- // sinast, cosast, 0,
903
- // 0, 0, 1
904
- // );
905
888
 
906
889
  return new Matrix3D(
907
890
  new Vector3D(cosast, -sinast, 0), new Vector3D(sinast, cosast, 0),
@@ -924,12 +907,6 @@ class FrameConverter {
924
907
  const cosyp = Math.cos(yp);
925
908
  const sinyp = Math.sin(yp);
926
909
 
927
- // // FK5 approach
928
- // return new Matrix3D(
929
- // cosxp, 0, -sinxp,
930
- // sinxp * sinyp, cosyp, cosxp * sinyp,
931
- // sinxp * cosyp, -sinyp, cosxp * cosyp
932
- // );
933
910
 
934
911
  return new Matrix3D(
935
912
  new Vector3D(cosxp, 0, -sinxp),
@@ -945,7 +922,7 @@ class FrameConverter {
945
922
  * @return {boolean} True if the frame is inertial, false otherwise
946
923
  */
947
924
  static CheckIfInertial(frame, throwError = false) {
948
- if (frame === ReferenceFrame.ITRF) {
925
+ if (typeof frame === "string" && frame === ReferenceFrame.ITRF) {
949
926
  if (throwError) {
950
927
  throw new Error(
951
928
  "Cannot use a non-inertial frame for this method."
@@ -1007,112 +984,112 @@ class FrameConverter {
1007
984
 
1008
985
  // 1980 IAU Theory of Nutation Coefficients
1009
986
  static NUT_COEFF = [
1010
- [0, 0, 0, 0, 1, -171996.0, -174.2, 92025.0, 8.9],
1011
- [0, 0, 2, -2, 2, -13187.0, -1.6, 5736.0, -3.1],
1012
- [0, 0, 2, 0, 2, -2274.0, -0.2, 977.0, -0.5],
1013
- [0, 0, 0, 0, 2, 2062.0, 0.2, -895.0, 0.5],
1014
- [0, 1, 0, 0, 0, 1426.0, -3.4, 54.0, -0.1],
1015
- [1, 0, 0, 0, 0, 712.0, 0.1, -7.0, 0.0],
1016
- [0, 1, 2, -2, 2, -517.0, 1.2, 224.0, -0.6],
1017
- [0, 0, 2, 0, 1, -386.0, -0.4, 200.0, 0.0],
1018
- [1, 0, 2, 0, 2, -301.0, 0.0, 129.0, -0.1],
1019
- [0, -1, 2, -2, 2, 217.0, -0.5, -95.0, 0.3],
1020
- [1, 0, 0, -2, 0, -158.0, 0.0, -1.0, 0.0],
1021
- [0, 0, 2, -2, 1, 129.0, 0.1, -70.0, 0.0],
1022
- [-1, 0, 2, 0, 2, 123.0, 0.0, -53.0, 0.0],
1023
- [1, 0, 0, 0, 1, 63.0, 0.1, -33.0, 0.0],
1024
- [0, 0, 0, 2, 0, 63.0, 0.0, -2.0, 0.0],
1025
- [-1, 0, 2, 2, 2, -59.0, 0.0, 26.0, 0.0],
1026
- [-1, 0, 0, 0, 1, -58.0, -0.1, 32.0, 0.0],
1027
- [1, 0, 2, 0, 1, -51.0, 0.0, 27.0, 0.0],
1028
- [2, 0, 0, -2, 0, 48.0, 0.0, 1.0, 0.0],
1029
- [-2, 0, 2, 0, 1, 46.0, 0.0, -24.0, 0.0],
1030
- [0, 0, 2, 2, 2, -38.0, 0.0, 16.0, 0.0],
1031
- [2, 0, 2, 0, 2, -31.0, 0.0, 13.0, 0.0],
1032
- [2, 0, 0, 0, 0, 29.0, 0.0, -1.0, 0.0],
1033
- [1, 0, 2, -2, 2, 29.0, 0.0, -12.0, 0.0],
1034
- [0, 0, 2, 0, 0, 26.0, 0.0, -1.0, 0.0],
1035
- [0, 0, 2, -2, 0, -22.0, 0.0, 0.0, 0.0],
1036
- [-1, 0, 2, 0, 1, 21.0, 0.0, -10.0, 0.0],
1037
- [0, 2, 0, 0, 0, 17.0, -0.1, 0.0, 0.0],
1038
- [0, 2, 2, -2, 2, -16.0, 0.1, 7.0, 0.0],
1039
- [-1, 0, 0, 2, 1, 16.0, 0.0, -8.0, 0.0],
1040
- [0, 1, 0, 0, 1, -15.0, 0.0, 9.0, 0.0],
1041
- [1, 0, 0, -2, 1, -13.0, 0.0, 7.0, 0.0],
1042
- [0, -1, 0, 0, 1, -12.0, 0.0, 6.0, 0.0],
1043
- [2, 0, -2, 0, 0, 11.0, 0.0, 0.0, 0.0],
1044
- [-1, 0, 2, 2, 1, -10.0, 0.0, 5.0, 0.0],
1045
- [1, 0, 2, 2, 2, -8.0, 0.0, 3.0, 0.0],
1046
- [0, -1, 2, 0, 2, -7.0, 0.0, 3.0, 0.0],
1047
- [0, 0, 2, 2, 1, -7.0, 0.0, 3.0, 0.0],
1048
- [1, 1, 0, -2, 0, -7.0, 0.0, 0.0, 0.0],
1049
- [0, 1, 2, 0, 2, 7.0, 0.0, -3.0, 0.0],
1050
- [-2, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0],
1051
- [0, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0],
1052
- [2, 0, 2, -2, 2, 6.0, 0.0, -3.0, 0.0],
1053
- [1, 0, 0, 2, 0, 6.0, 0.0, 0.0, 0.0],
1054
- [1, 0, 2, -2, 1, 6.0, 0.0, -3.0, 0.0],
1055
- [0, 0, 0, -2, 1, -5.0, 0.0, 3.0, 0.0],
1056
- [0, -1, 2, -2, 1, -5.0, 0.0, 3.0, 0.0],
1057
- [2, 0, 2, 0, 1, -5.0, 0.0, 3.0, 0.0],
1058
- [1, -1, 0, 0, 0, 5.0, 0.0, 0.0, 0.0],
1059
- [1, 0, 0, -1, 0, -4.0, 0.0, 0.0, 0.0],
1060
- [0, 0, 0, 1, 0, -4.0, 0.0, 0.0, 0.0],
1061
- [0, 1, 0, -2, 0, -4.0, 0.0, 0.0, 0.0],
1062
- [1, 0, -2, 0, 0, 4.0, 0.0, 0.0, 0.0],
1063
- [2, 0, 0, -2, 1, 4.0, 0.0, -2.0, 0.0],
1064
- [0, 1, 2, -2, 1, 4.0, 0.0, -2.0, 0.0],
1065
- [1, 1, 0, 0, 0, -3.0, 0.0, 0.0, 0.0],
1066
- [1, -1, 0, -1, 0, -3.0, 0.0, 0.0, 0.0],
1067
- [-1, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0],
1068
- [0, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0],
1069
- [1, -1, 2, 0, 2, -3.0, 0.0, 1.0, 0.0],
1070
- [3, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0],
1071
- [-2, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0],
1072
- [1, 0, 2, 0, 0, 3.0, 0.0, 0.0, 0.0],
1073
- [-1, 0, 2, 4, 2, -2.0, 0.0, 1.0, 0.0],
1074
- [1, 0, 0, 0, 2, -2.0, 0.0, 1.0, 0.0],
1075
- [-1, 0, 2, -2, 1, -2.0, 0.0, 1.0, 0.0],
1076
- [0, -2, 2, -2, 1, -2.0, 0.0, 1.0, 0.0],
1077
- [-2, 0, 0, 0, 1, -2.0, 0.0, 1.0, 0.0],
1078
- [2, 0, 0, 0, 1, 2.0, 0.0, -1.0, 0.0],
1079
- [3, 0, 0, 0, 0, 2.0, 0.0, 0.0, 0.0],
1080
- [1, 1, 2, 0, 2, 2.0, 0.0, -1.0, 0.0],
1081
- [0, 0, 2, 1, 2, 2.0, 0.0, -1.0, 0.0],
1082
- [1, 0, 0, 2, 1, -1.0, 0.0, 0.0, 0.0],
1083
- [1, 0, 2, 2, 1, -1.0, 0.0, 1.0, 0.0],
1084
- [1, 1, 0, -2, 1, -1.0, 0.0, 0.0, 0.0],
1085
- [0, 1, 0, 2, 0, -1.0, 0.0, 0.0, 0.0],
1086
- [0, 1, 2, -2, 0, -1.0, 0.0, 0.0, 0.0],
1087
- [0, 1, -2, 2, 0, -1.0, 0.0, 0.0, 0.0],
1088
- [1, 0, -2, 2, 0, -1.0, 0.0, 0.0, 0.0],
1089
- [1, 0, -2, -2, 0, -1.0, 0.0, 0.0, 0.0],
1090
- [1, 0, 2, -2, 0, -1.0, 0.0, 0.0, 0.0],
1091
- [1, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0],
1092
- [2, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0],
1093
- [0, 0, 2, 4, 2, -1.0, 0.0, 0.0, 0.0],
1094
- [0, 0, 2, -1, 2, -1.0, 0.0, 0.0, 0.0],
1095
- [-2, 0, 2, 4, 2, -1.0, 0.0, 1.0, 0.0],
1096
- [2, 0, 2, 2, 2, -1.0, 0.0, 0.0, 0.0],
1097
- [0, -1, 2, 0, 1, -1.0, 0.0, 0.0, 0.0],
1098
- [0, 0, -2, 0, 1, -1.0, 0.0, 0.0, 0.0],
1099
- [0, 0, 4, -2, 2, 1.0, 0.0, 0.0, 0.0],
1100
- [0, 1, 0, 0, 2, 1.0, 0.0, 0.0, 0.0],
1101
- [1, 1, 2, -2, 2, 1.0, 0.0, -1.0, 0.0],
1102
- [3, 0, 2, -2, 2, 1.0, 0.0, 0.0, 0.0],
1103
- [-2, 0, 2, 2, 2, 1.0, 0.0, -1.0, 0.0],
1104
- [-1, 0, 0, 0, 2, 1.0, 0.0, -1.0, 0.0],
1105
- [0, 0, -2, 2, 1, 1.0, 0.0, 0.0, 0.0],
1106
- [0, 1, 2, 0, 1, 1.0, 0.0, 0.0, 0.0],
1107
- [-1, 0, 4, 0, 2, 1.0, 0.0, 0.0, 0.0],
1108
- [2, 1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0],
1109
- [2, 0, 0, 2, 0, 1.0, 0.0, 0.0, 0.0],
1110
- [2, 0, 2, -2, 1, 1.0, 0.0, -1.0, 0.0],
1111
- [2, 0, -2, 0, 1, 1.0, 0.0, 0.0, 0.0],
1112
- [1, -1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0],
1113
- [-1, 0, 0, 1, 1, 1.0, 0.0, 0.0, 0.0],
1114
- [-1, -1, 0, 2, 1, 1.0, 0.0, 0.0, 0.0],
1115
- [0, 1, 0, 1, 0, 1.0, 0.0, 0.0, 0.0],
987
+ [0, 0, 0, 0, 1, -171996, -174.2, 92025, 8.9],
988
+ [0, 0, 2, -2, 2, -13187, -1.6, 5736, -3.1],
989
+ [0, 0, 2, 0, 2, -2274, -0.2, 977, -0.5],
990
+ [0, 0, 0, 0, 2, 2062, 0.2, -895, 0.5],
991
+ [0, 1, 0, 0, 0, 1426, -3.4, 54, -0.1],
992
+ [1, 0, 0, 0, 0, 712, 0.1, -7, 0],
993
+ [0, 1, 2, -2, 2, -517, 1.2, 224, -0.6],
994
+ [0, 0, 2, 0, 1, -386, -0.4, 200, 0],
995
+ [1, 0, 2, 0, 2, -301, 0, 129, -0.1],
996
+ [0, -1, 2, -2, 2, 217, -0.5, -95, 0.3],
997
+ [1, 0, 0, -2, 0, -158, 0, -1, 0],
998
+ [0, 0, 2, -2, 1, 129, 0.1, -70, 0],
999
+ [-1, 0, 2, 0, 2, 123, 0, -53, 0],
1000
+ [1, 0, 0, 0, 1, 63, 0.1, -33, 0],
1001
+ [0, 0, 0, 2, 0, 63, 0, -2, 0],
1002
+ [-1, 0, 2, 2, 2, -59, 0, 26, 0],
1003
+ [-1, 0, 0, 0, 1, -58, -0.1, 32, 0],
1004
+ [1, 0, 2, 0, 1, -51, 0, 27, 0],
1005
+ [2, 0, 0, -2, 0, 48, 0, 1, 0],
1006
+ [-2, 0, 2, 0, 1, 46, 0, -24, 0],
1007
+ [0, 0, 2, 2, 2, -38, 0, 16, 0],
1008
+ [2, 0, 2, 0, 2, -31, 0, 13, 0],
1009
+ [2, 0, 0, 0, 0, 29, 0, -1, 0],
1010
+ [1, 0, 2, -2, 2, 29, 0, -12, 0],
1011
+ [0, 0, 2, 0, 0, 26, 0, -1, 0],
1012
+ [0, 0, 2, -2, 0, -22, 0, 0, 0],
1013
+ [-1, 0, 2, 0, 1, 21, 0, -10, 0],
1014
+ [0, 2, 0, 0, 0, 17, -0.1, 0, 0],
1015
+ [0, 2, 2, -2, 2, -16, 0.1, 7, 0],
1016
+ [-1, 0, 0, 2, 1, 16, 0, -8, 0],
1017
+ [0, 1, 0, 0, 1, -15, 0, 9, 0],
1018
+ [1, 0, 0, -2, 1, -13, 0, 7, 0],
1019
+ [0, -1, 0, 0, 1, -12, 0, 6, 0],
1020
+ [2, 0, -2, 0, 0, 11, 0, 0, 0],
1021
+ [-1, 0, 2, 2, 1, -10, 0, 5, 0],
1022
+ [1, 0, 2, 2, 2, -8, 0, 3, 0],
1023
+ [0, -1, 2, 0, 2, -7, 0, 3, 0],
1024
+ [0, 0, 2, 2, 1, -7, 0, 3, 0],
1025
+ [1, 1, 0, -2, 0, -7, 0, 0, 0],
1026
+ [0, 1, 2, 0, 2, 7, 0, -3, 0],
1027
+ [-2, 0, 0, 2, 1, -6, 0, 3, 0],
1028
+ [0, 0, 0, 2, 1, -6, 0, 3, 0],
1029
+ [2, 0, 2, -2, 2, 6, 0, -3, 0],
1030
+ [1, 0, 0, 2, 0, 6, 0, 0, 0],
1031
+ [1, 0, 2, -2, 1, 6, 0, -3, 0],
1032
+ [0, 0, 0, -2, 1, -5, 0, 3, 0],
1033
+ [0, -1, 2, -2, 1, -5, 0, 3, 0],
1034
+ [2, 0, 2, 0, 1, -5, 0, 3, 0],
1035
+ [1, -1, 0, 0, 0, 5, 0, 0, 0],
1036
+ [1, 0, 0, -1, 0, -4, 0, 0, 0],
1037
+ [0, 0, 0, 1, 0, -4, 0, 0, 0],
1038
+ [0, 1, 0, -2, 0, -4, 0, 0, 0],
1039
+ [1, 0, -2, 0, 0, 4, 0, 0, 0],
1040
+ [2, 0, 0, -2, 1, 4, 0, -2, 0],
1041
+ [0, 1, 2, -2, 1, 4, 0, -2, 0],
1042
+ [1, 1, 0, 0, 0, -3, 0, 0, 0],
1043
+ [1, -1, 0, -1, 0, -3, 0, 0, 0],
1044
+ [-1, -1, 2, 2, 2, -3, 0, 1, 0],
1045
+ [0, -1, 2, 2, 2, -3, 0, 1, 0],
1046
+ [1, -1, 2, 0, 2, -3, 0, 1, 0],
1047
+ [3, 0, 2, 0, 2, -3, 0, 1, 0],
1048
+ [-2, 0, 2, 0, 2, -3, 0, 1, 0],
1049
+ [1, 0, 2, 0, 0, 3, 0, 0, 0],
1050
+ [-1, 0, 2, 4, 2, -2, 0, 1, 0],
1051
+ [1, 0, 0, 0, 2, -2, 0, 1, 0],
1052
+ [-1, 0, 2, -2, 1, -2, 0, 1, 0],
1053
+ [0, -2, 2, -2, 1, -2, 0, 1, 0],
1054
+ [-2, 0, 0, 0, 1, -2, 0, 1, 0],
1055
+ [2, 0, 0, 0, 1, 2, 0, -1, 0],
1056
+ [3, 0, 0, 0, 0, 2, 0, 0, 0],
1057
+ [1, 1, 2, 0, 2, 2, 0, -1, 0],
1058
+ [0, 0, 2, 1, 2, 2, 0, -1, 0],
1059
+ [1, 0, 0, 2, 1, -1, 0, 0, 0],
1060
+ [1, 0, 2, 2, 1, -1, 0, 1, 0],
1061
+ [1, 1, 0, -2, 1, -1, 0, 0, 0],
1062
+ [0, 1, 0, 2, 0, -1, 0, 0, 0],
1063
+ [0, 1, 2, -2, 0, -1, 0, 0, 0],
1064
+ [0, 1, -2, 2, 0, -1, 0, 0, 0],
1065
+ [1, 0, -2, 2, 0, -1, 0, 0, 0],
1066
+ [1, 0, -2, -2, 0, -1, 0, 0, 0],
1067
+ [1, 0, 2, -2, 0, -1, 0, 0, 0],
1068
+ [1, 0, 0, -4, 0, -1, 0, 0, 0],
1069
+ [2, 0, 0, -4, 0, -1, 0, 0, 0],
1070
+ [0, 0, 2, 4, 2, -1, 0, 0, 0],
1071
+ [0, 0, 2, -1, 2, -1, 0, 0, 0],
1072
+ [-2, 0, 2, 4, 2, -1, 0, 1, 0],
1073
+ [2, 0, 2, 2, 2, -1, 0, 0, 0],
1074
+ [0, -1, 2, 0, 1, -1, 0, 0, 0],
1075
+ [0, 0, -2, 0, 1, -1, 0, 0, 0],
1076
+ [0, 0, 4, -2, 2, 1, 0, 0, 0],
1077
+ [0, 1, 0, 0, 2, 1, 0, 0, 0],
1078
+ [1, 1, 2, -2, 2, 1, 0, -1, 0],
1079
+ [3, 0, 2, -2, 2, 1, 0, 0, 0],
1080
+ [-2, 0, 2, 2, 2, 1, 0, -1, 0],
1081
+ [-1, 0, 0, 0, 2, 1, 0, -1, 0],
1082
+ [0, 0, -2, 2, 1, 1, 0, 0, 0],
1083
+ [0, 1, 2, 0, 1, 1, 0, 0, 0],
1084
+ [-1, 0, 4, 0, 2, 1, 0, 0, 0],
1085
+ [2, 1, 0, -2, 0, 1, 0, 0, 0],
1086
+ [2, 0, 0, 2, 0, 1, 0, 0, 0],
1087
+ [2, 0, 2, -2, 1, 1, 0, -1, 0],
1088
+ [2, 0, -2, 0, 1, 1, 0, 0, 0],
1089
+ [1, -1, 0, -2, 0, 1, 0, 0, 0],
1090
+ [-1, 0, 0, 1, 1, 1, 0, 0, 0],
1091
+ [-1, -1, 0, 2, 1, 1, 0, 0, 0],
1092
+ [0, 1, 0, 1, 0, 1, 0, 0, 0],
1116
1093
  ];
1117
1094
  }
1118
1095
 
package/src/LLA.js CHANGED
@@ -18,7 +18,7 @@ class LLA {
18
18
  if (
19
19
  latitudeDeg instanceof Angle || (latitudeDeg
20
20
  && typeof latitudeDeg === "object"
21
- && Object.prototype.hasOwnProperty.call(latitudeDeg, "Degrees"))
21
+ && Object.hasOwn(latitudeDeg, "Degrees"))
22
22
  ) {
23
23
  this._initFromAngles(latitudeDeg, longitudeDeg, altitudeKm);
24
24
  } else {
@@ -54,7 +54,6 @@ class LaunchNominalClass {
54
54
  let bearingRad = degreesToRadians(bearingDeg);
55
55
  bearingRad = wrapOneRevUnsigned(bearingRad);
56
56
 
57
- // const latRad = degreesToRadians(this.groundSiteLat);
58
57
  const latRad = llaVals.Latitude.Radians;
59
58
  const targetInclination = OrbitUtils.getInclination(bearingRad, latRad);
60
59
 
@@ -77,19 +76,6 @@ class LaunchNominalClass {
77
76
  );
78
77
  // Trying something here
79
78
 
80
- // const transformMatrix = FrameConverter.j2000ToTEME(orbitInsertionTime);
81
- // const initialTemeState = {
82
- // position: this.transformVector(
83
- // new Vector3D(initialStateVector.position[0],
84
- // initialStateVector.position[1], initialStateVector.position[2]),
85
- // transformMatrix
86
- // ),
87
- // velocity: this.transformVector(
88
- // new Vector3D(initialStateVector.velocity[0],
89
- // initialStateVector.velocity[1], initialStateVector.velocity[2]),
90
- // transformMatrix
91
- // ),
92
- // };
93
79
 
94
80
  // End of something
95
81
  const initialJ2000State = new J2000(
@@ -352,7 +338,7 @@ class LaunchNominalClass {
352
338
  */
353
339
  static generateStateOverGroundsite(
354
340
  orbitInsertionTime, azimuthDeg, orbitAltitudeKm, frame = ReferenceFrame.J2000, llaVals) {
355
- const minAltitudeKm = 1.0; // minimum launch altitude. Lowest recoded is about 440m.
341
+ const minAltitudeKm = 1; // minimum launch altitude. Lowest recoded is about 440m.
356
342
  if (orbitAltitudeKm < minAltitudeKm) {
357
343
  throw new Error(`Altitude cannot be less than ${minAltitudeKm} km.`);
358
344
  }
@@ -392,7 +378,7 @@ class LaunchNominalClass {
392
378
  const r = siteJ2000.scale(scaleFactor);
393
379
 
394
380
  // North vector rotated by azimuth along nadir vector scaled by the velocity of a circular orbit
395
- const rLength = Math.sqrt(r.x * r.x + r.y * r.y + r.z * r.z);
381
+ const rLength = Math.hypot(r.x, r.y, r.z);
396
382
  const velocityMagnitude = Math.sqrt(mu / rLength);
397
383
  const velocityDirection = FrameConverter.rotateVector(northJ2000, nadirJ2000, azimuthRad);
398
384
  const v = velocityDirection.scale(velocityMagnitude);
@@ -424,10 +410,10 @@ class LaunchNominalClass {
424
410
  const v0 = [stateAtM1.velocity.x, stateAtM1.velocity.y, stateAtM1.velocity.z];
425
411
  const r0mag = norm(r0);
426
412
  const v0mag = norm(v0);
427
- const r1 = r0.map((component) => component * -1.0 * targetSMA / r0mag);
413
+ const r1 = r0.map((component) => component * -1 * targetSMA / r0mag);
428
414
  const r1mag = norm(r1);
429
415
  const v1mag = Math.sqrt(mu / targetSMA);
430
- const v1 = v0.map((component) => component * -1.0 * v1mag / v0mag);
416
+ const v1 = v0.map((component) => component * -1 * v1mag / v0mag);
431
417
 
432
418
  // v0 and v1 unit vectors
433
419
  const v0unit = v0.map((component) => component / v0mag);
@@ -493,9 +479,9 @@ class LaunchNominalClass {
493
479
 
494
480
  if (burnAtNodes % 2 === 0) {
495
481
  if (argLat >= 0 && argLat <= 180) {
496
- argLat -= 180.0;
482
+ argLat -= 180;
497
483
  } else {
498
- argLat += 180.0;
484
+ argLat += 180;
499
485
  }
500
486
  }
501
487
 
@@ -538,7 +524,7 @@ class LaunchNominalClass {
538
524
 
539
525
  static #getNextNodeCrossingGeoOrbit(sv) {
540
526
  const geoElements = {
541
- semiMajorAxis: 35786.0 + EARTH_RADIUS_KM,
527
+ semiMajorAxis: 35786 + EARTH_RADIUS_KM,
542
528
  eccentricity: 0,
543
529
  inclination: 0,
544
530
  raan: 0,
@@ -556,7 +542,7 @@ class LaunchNominalClass {
556
542
  static #findMutualNodeTimes(sv1, sv2, muEarth = MU / 1e9) {
557
543
  // Implementation for finding mutual node times between two state vectors
558
544
 
559
- if (!(sv1.epochUtc === sv2.epochUtc)) {
545
+ if (sv1.epochUtc !== sv2.epochUtc) {
560
546
  return "lol what on earth";
561
547
  }
562
548
 
@@ -650,8 +636,8 @@ class LaunchNominalClass {
650
636
  second = new Date(sv1.epochUtc.getTime() + dt1 * 1000);
651
637
  }
652
638
 
653
- const next = first < second ? first : second;
654
- const previous = first < second ? second : first;
639
+ const next = new Date(Math.min(first.getTime(), second.getTime()));
640
+ const previous = new Date(Math.max(first.getTime(), second.getTime()));
655
641
 
656
642
  if (ascendingFirst) {
657
643
  return {
@@ -36,14 +36,14 @@ class NodeVector3D {
36
36
  }
37
37
 
38
38
  magnitude() {
39
- return Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2);
39
+ return Math.hypot(this.x, this.y, this.z);
40
40
  }
41
41
 
42
42
  distance(vector) {
43
43
  const dx = this.x - vector.x;
44
44
  const dy = this.y - vector.y;
45
45
  const dz = this.z - vector.z;
46
- return Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2);
46
+ return Math.hypot(dx, dy, dz);
47
47
  }
48
48
 
49
49
  toString() {