sweph 2.10.2-2 → 2.10.2-3

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/index.d.ts CHANGED
@@ -157,7 +157,7 @@ declare module "sweph" {
157
157
  * ```
158
158
  * ```
159
159
  */
160
- data: CalcData2;
160
+ data: CalcData2;
161
161
  }
162
162
 
163
163
  interface FixStarMag extends Flag, Name, Error {
@@ -419,7 +419,7 @@ declare module "sweph" {
419
419
  * ```
420
420
  * ```
421
421
  */
422
- data: EclipseTimes3
422
+ data: EclipseTimes3
423
423
  }
424
424
 
425
425
  interface LunOccultWhenLoc extends Flag, Error {
@@ -464,7 +464,7 @@ declare module "sweph" {
464
464
  * ```
465
465
  * ```
466
466
  */
467
- data: {
467
+ data: {
468
468
  /**
469
469
  * ### Description
470
470
  * Array of ascending node values returned by the calculation
@@ -510,7 +510,7 @@ declare module "sweph" {
510
510
  * ```
511
511
  */
512
512
  aphelion: CalcData2;
513
- };
513
+ };
514
514
  }
515
515
 
516
516
  interface Pheno extends Flag, Error {
@@ -1524,7 +1524,7 @@ declare module "sweph" {
1524
1524
  * Time of third contact
1525
1525
  */
1526
1526
  third_contact: number,
1527
- /**
1527
+ /**
1528
1528
  * Time of fourth contact
1529
1529
  */
1530
1530
  fourth_contact: number,
@@ -1840,7 +1840,7 @@ declare module "sweph" {
1840
1840
  * ### Params
1841
1841
  * ```
1842
1842
  * • tjd_ut: number // Julian day in universal time
1843
- * • calc_flag: number // Calculation flag, SE_HOR2ECL or SE_HOR2EQU
1843
+ * • calc_flag: number // Calculation flag, SE_ECL2HOR or SE_EQU2HOR
1844
1844
  * • geopos: Array<number> // Geographic coordinates [longitude, latitude, elevation]
1845
1845
  * • atpress: number // Atmospheric pressure in mbar/hpa
1846
1846
  * • attemp: number // Atmospheric temperature in celcius
@@ -3721,7 +3721,7 @@ declare module "sweph" {
3721
3721
  * ```
3722
3722
  * &nbsp;
3723
3723
  */
3724
- export function mooncross_node_ut(jd_ut: number, flag: number): NodeCross;
3724
+ export function mooncross_node_ut(jd_ut: number, flag: number): NodeCross;
3725
3725
 
3726
3726
  /**
3727
3727
  * ### Description
@@ -3776,9 +3776,9 @@ declare module "sweph" {
3776
3776
  * ```
3777
3777
  * &nbsp;
3778
3778
  */
3779
- export function mooncross_ut(x2cross: number, jd_ut: number, flag: number): Cross;
3779
+ export function mooncross_ut(x2cross: number, jd_ut: number, flag: number): Cross;
3780
3780
 
3781
- /**
3781
+ /**
3782
3782
  * ### Description
3783
3783
  * Compute Moon's crossing over some longitude
3784
3784
  * ### Params
@@ -3803,7 +3803,7 @@ declare module "sweph" {
3803
3803
  * ```
3804
3804
  * &nbsp;
3805
3805
  */
3806
- export function mooncross(x2cross: number, jd_et: number, flag: number): Cross;
3806
+ export function mooncross(x2cross: number, jd_et: number, flag: number): Cross;
3807
3807
 
3808
3808
  /**
3809
3809
  * ### Description
@@ -3868,7 +3868,7 @@ declare module "sweph" {
3868
3868
  */
3869
3869
  export function nod_aps_ut(tjd_ut: number, ipl: number, iflag: number, method: number): NodAps;
3870
3870
 
3871
- /**
3871
+ /**
3872
3872
  * ### Description
3873
3873
  * Calculate an object's nodes and apsides from ephemeris/terrestrial time
3874
3874
  * If the calculation method includes `SE_NODBIT_FOPOINT`, the `aphelion` field contains the values for the object's "second focus" instead
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createRequire } from 'module';
1
+ import { createRequire } from "module";
2
2
  import c from "./constants.js";
3
3
 
4
4
  const require = createRequire(import.meta.url);
@@ -8,102 +8,102 @@ sweph.constants = c;
8
8
  sweph.sweph = sweph;
9
9
  sweph.default = sweph;
10
10
 
11
- export default sweph
12
- export const constants = sweph.constants
13
- export const close = sweph.close
14
- export const set_delta_t_userdef = sweph.set_delta_t_userdef
15
- export const set_ephe_path = sweph.set_ephe_path
16
- export const set_jpl_file = sweph.set_jpl_file
17
- export const set_sid_mode = sweph.set_sid_mode
18
- export const set_tid_acc = sweph.set_tid_acc
19
- export const set_topo = sweph.set_topo
20
- export const version = sweph.version
21
- export const get_library_path = sweph.get_library_path
22
- export const get_tid_acc = sweph.get_tid_acc
23
- export const get_planet_name = sweph.get_planet_name
24
- export const get_current_file_data = sweph.get_current_file_data
25
- export const get_orbital_elements = sweph.get_orbital_elements
26
- export const get_ayanamsa_name = sweph.get_ayanamsa_name
27
- export const get_ayanamsa_ex_ut = sweph.get_ayanamsa_ex_ut
28
- export const get_ayanamsa_ex = sweph.get_ayanamsa_ex
29
- export const get_ayanamsa_ut = sweph.get_ayanamsa_ut
30
- export const get_ayanamsa = sweph.get_ayanamsa
31
- export const calc = sweph.calc
32
- export const calc_ut = sweph.calc_ut
33
- export const calc_pctr = sweph.calc_pctr
34
- export const fixstar = sweph.fixstar
35
- export const fixstar_ut = sweph.fixstar_ut
36
- export const fixstar_mag = sweph.fixstar_mag
37
- export const fixstar2 = sweph.fixstar2
38
- export const fixstar2_ut = sweph.fixstar2_ut
39
- export const fixstar2_mag = sweph.fixstar2_mag
40
- export const nod_aps = sweph.nod_aps
41
- export const nod_aps_ut = sweph.nod_aps_ut
42
- export const orbit_max_min_true_distance = sweph.orbit_max_min_true_distance
43
- export const sol_eclipse_when_loc = sweph.sol_eclipse_when_loc
44
- export const sol_eclipse_when_glob = sweph.sol_eclipse_when_glob
45
- export const sol_eclipse_how = sweph.sol_eclipse_how
46
- export const sol_eclipse_where = sweph.sol_eclipse_where
47
- export const lun_occult_when_loc = sweph.lun_occult_when_loc
48
- export const lun_occult_when_glob = sweph.lun_occult_when_glob
49
- export const lun_occult_where = sweph.lun_occult_where
50
- export const lun_eclipse_when_loc = sweph.lun_eclipse_when_loc
51
- export const lun_eclipse_when = sweph.lun_eclipse_when
52
- export const lun_eclipse_how = sweph.lun_eclipse_how
53
- export const rise_trans = sweph.rise_trans
54
- export const rise_trans_true_hor = sweph.rise_trans_true_hor
55
- export const pheno = sweph.pheno
56
- export const pheno_ut = sweph.pheno_ut
57
- export const azalt = sweph.azalt
58
- export const azalt_rev = sweph.azalt_rev
59
- export const refrac = sweph.refrac
60
- export const refrac_extended = sweph.refrac_extended
61
- export const heliacal_ut = sweph.heliacal_ut
62
- export const vis_limit_mag = sweph.vis_limit_mag
63
- export const heliacal_pheno_ut = sweph.heliacal_pheno_ut
64
- export const julday = sweph.julday
65
- export const date_conversion = sweph.date_conversion
66
- export const revjul = sweph.revjul
67
- export const utc_time_zone = sweph.utc_time_zone
68
- export const utc_to_jd = sweph.utc_to_jd
69
- export const jdet_to_utc = sweph.jdet_to_utc
70
- export const jdut1_to_utc = sweph.jdut1_to_utc
71
- export const time_equ = sweph.time_equ
72
- export const lmt_to_lat = sweph.lmt_to_lat
73
- export const lat_to_lmt = sweph.lat_to_lmt
74
- export const deltat = sweph.deltat
75
- export const deltat_ex = sweph.deltat_ex
76
- export const house_name = sweph.house_name
77
- export const houses = sweph.houses
78
- export const houses_armc = sweph.houses_armc
79
- export const houses_armc_ex2 = sweph.houses_armc_ex2
80
- export const houses_ex = sweph.houses_ex
81
- export const houses_ex2 = sweph.houses_ex2
82
- export const house_pos = sweph.house_pos
83
- export const gauquelin_sector = sweph.gauquelin_sector
84
- export const sidtime = sweph.sidtime
85
- export const sidtime0 = sweph.sidtime0
86
- export const cotrans = sweph.cotrans
87
- export const cotrans_sp = sweph.cotrans_sp
88
- export const degnorm = sweph.degnorm
89
- export const radnorm = sweph.radnorm
90
- export const split_deg = sweph.split_deg
91
- export const csnorm = sweph.csnorm
92
- export const difcsn = sweph.difcsn
93
- export const difdegn = sweph.difdegn
94
- export const difcs2n = sweph.difcs2n
95
- export const difdeg2n = sweph.difdeg2n
96
- export const csroundsec = sweph.csroundsec
97
- export const d2l = sweph.d2l
98
- export const day_of_week = sweph.day_of_week
99
- export const cs2timestr = sweph.cs2timestr
100
- export const cs2lonlatstr = sweph.cs2lonlatstr
101
- export const cs2degstr = sweph.cs2degstr
102
- export const solcross = sweph.solcross
103
- export const solcross_ut = sweph.solcross_ut
104
- export const mooncross = sweph.mooncross
105
- export const mooncross_ut = sweph.mooncross_ut
106
- export const mooncross_node = sweph.mooncross_node
107
- export const mooncross_node_ut = sweph.mooncross_node_ut
108
- export const helio_cross = sweph.helio_cross
109
- export const helio_cross_ut = sweph.helio_cross_ut
11
+ export default sweph;
12
+ export const constants = sweph.constants;
13
+ export const close = sweph.close;
14
+ export const set_delta_t_userdef = sweph.set_delta_t_userdef;
15
+ export const set_ephe_path = sweph.set_ephe_path;
16
+ export const set_jpl_file = sweph.set_jpl_file;
17
+ export const set_sid_mode = sweph.set_sid_mode;
18
+ export const set_tid_acc = sweph.set_tid_acc;
19
+ export const set_topo = sweph.set_topo;
20
+ export const version = sweph.version;
21
+ export const get_library_path = sweph.get_library_path;
22
+ export const get_tid_acc = sweph.get_tid_acc;
23
+ export const get_planet_name = sweph.get_planet_name;
24
+ export const get_current_file_data = sweph.get_current_file_data;
25
+ export const get_orbital_elements = sweph.get_orbital_elements;
26
+ export const get_ayanamsa_name = sweph.get_ayanamsa_name;
27
+ export const get_ayanamsa_ex_ut = sweph.get_ayanamsa_ex_ut;
28
+ export const get_ayanamsa_ex = sweph.get_ayanamsa_ex;
29
+ export const get_ayanamsa_ut = sweph.get_ayanamsa_ut;
30
+ export const get_ayanamsa = sweph.get_ayanamsa;
31
+ export const calc = sweph.calc;
32
+ export const calc_ut = sweph.calc_ut;
33
+ export const calc_pctr = sweph.calc_pctr;
34
+ export const fixstar = sweph.fixstar;
35
+ export const fixstar_ut = sweph.fixstar_ut;
36
+ export const fixstar_mag = sweph.fixstar_mag;
37
+ export const fixstar2 = sweph.fixstar2;
38
+ export const fixstar2_ut = sweph.fixstar2_ut;
39
+ export const fixstar2_mag = sweph.fixstar2_mag;
40
+ export const nod_aps = sweph.nod_aps;
41
+ export const nod_aps_ut = sweph.nod_aps_ut;
42
+ export const orbit_max_min_true_distance = sweph.orbit_max_min_true_distance;
43
+ export const sol_eclipse_when_loc = sweph.sol_eclipse_when_loc;
44
+ export const sol_eclipse_when_glob = sweph.sol_eclipse_when_glob;
45
+ export const sol_eclipse_how = sweph.sol_eclipse_how;
46
+ export const sol_eclipse_where = sweph.sol_eclipse_where;
47
+ export const lun_occult_when_loc = sweph.lun_occult_when_loc;
48
+ export const lun_occult_when_glob = sweph.lun_occult_when_glob;
49
+ export const lun_occult_where = sweph.lun_occult_where;
50
+ export const lun_eclipse_when_loc = sweph.lun_eclipse_when_loc;
51
+ export const lun_eclipse_when = sweph.lun_eclipse_when;
52
+ export const lun_eclipse_how = sweph.lun_eclipse_how;
53
+ export const rise_trans = sweph.rise_trans;
54
+ export const rise_trans_true_hor = sweph.rise_trans_true_hor;
55
+ export const pheno = sweph.pheno;
56
+ export const pheno_ut = sweph.pheno_ut;
57
+ export const azalt = sweph.azalt;
58
+ export const azalt_rev = sweph.azalt_rev;
59
+ export const refrac = sweph.refrac;
60
+ export const refrac_extended = sweph.refrac_extended;
61
+ export const heliacal_ut = sweph.heliacal_ut;
62
+ export const vis_limit_mag = sweph.vis_limit_mag;
63
+ export const heliacal_pheno_ut = sweph.heliacal_pheno_ut;
64
+ export const julday = sweph.julday;
65
+ export const date_conversion = sweph.date_conversion;
66
+ export const revjul = sweph.revjul;
67
+ export const utc_time_zone = sweph.utc_time_zone;
68
+ export const utc_to_jd = sweph.utc_to_jd;
69
+ export const jdet_to_utc = sweph.jdet_to_utc;
70
+ export const jdut1_to_utc = sweph.jdut1_to_utc;
71
+ export const time_equ = sweph.time_equ;
72
+ export const lmt_to_lat = sweph.lmt_to_lat;
73
+ export const lat_to_lmt = sweph.lat_to_lmt;
74
+ export const deltat = sweph.deltat;
75
+ export const deltat_ex = sweph.deltat_ex;
76
+ export const house_name = sweph.house_name;
77
+ export const houses = sweph.houses;
78
+ export const houses_armc = sweph.houses_armc;
79
+ export const houses_armc_ex2 = sweph.houses_armc_ex2;
80
+ export const houses_ex = sweph.houses_ex;
81
+ export const houses_ex2 = sweph.houses_ex2;
82
+ export const house_pos = sweph.house_pos;
83
+ export const gauquelin_sector = sweph.gauquelin_sector;
84
+ export const sidtime = sweph.sidtime;
85
+ export const sidtime0 = sweph.sidtime0;
86
+ export const cotrans = sweph.cotrans;
87
+ export const cotrans_sp = sweph.cotrans_sp;
88
+ export const degnorm = sweph.degnorm;
89
+ export const radnorm = sweph.radnorm;
90
+ export const split_deg = sweph.split_deg;
91
+ export const csnorm = sweph.csnorm;
92
+ export const difcsn = sweph.difcsn;
93
+ export const difdegn = sweph.difdegn;
94
+ export const difcs2n = sweph.difcs2n;
95
+ export const difdeg2n = sweph.difdeg2n;
96
+ export const csroundsec = sweph.csroundsec;
97
+ export const d2l = sweph.d2l;
98
+ export const day_of_week = sweph.day_of_week;
99
+ export const cs2timestr = sweph.cs2timestr;
100
+ export const cs2lonlatstr = sweph.cs2lonlatstr;
101
+ export const cs2degstr = sweph.cs2degstr;
102
+ export const solcross = sweph.solcross;
103
+ export const solcross_ut = sweph.solcross_ut;
104
+ export const mooncross = sweph.mooncross;
105
+ export const mooncross_ut = sweph.mooncross_ut;
106
+ export const mooncross_node = sweph.mooncross_node;
107
+ export const mooncross_node_ut = sweph.mooncross_node_ut;
108
+ export const helio_cross = sweph.helio_cross;
109
+ export const helio_cross_ut = sweph.helio_cross_ut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sweph",
3
- "version": "2.10.2-2",
3
+ "version": "2.10.2-3",
4
4
  "description": "The definitive Swiss Ephemeris bindings for Node.js",
5
5
  "main": "index.js",
6
6
  "typings": "./index.d.ts",
@@ -34,6 +34,6 @@
34
34
  "author": "Timotej Valentin Rojko",
35
35
  "license": "(AGPL-3.0-or-later OR LGPL-3.0-or-later)",
36
36
  "devDependencies": {
37
- "eslint": "^7.31.0"
37
+ "eslint": "^8.21.0"
38
38
  }
39
39
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  constexpr std::pair<int, const char*> args[] = {
4
4
  { 1, "Expecting 1 argument: hsys" },
5
- { NUMBER, "Argument 1 should be a number - house system ID" }
5
+ { STRING, "Argument 1 should be a string - house system ID" }
6
6
  };
7
7
 
8
8
  Napi::Value sweph_house_name(const Napi::CallbackInfo& info) {
@@ -10,7 +10,8 @@ Napi::Value sweph_house_name(const Napi::CallbackInfo& info) {
10
10
  if(!sweph_type_check(args, info)) {
11
11
  return env.Null();
12
12
  }
13
- const char* name = swe_house_name(info[0].As<Napi::Number>().Int32Value());
13
+ char sys = info[0].As<Napi::String>().Utf8Value()[0];
14
+ const char* name = swe_house_name(int(sys));
14
15
  if(name == NULL) {
15
16
  Napi::TypeError::New(env, "Invalid house system").ThrowAsJavaScriptException();
16
17
  return env.Null();
@@ -16,7 +16,6 @@ Napi::Value sweph_houses(const Napi::CallbackInfo& info) {
16
16
  double cusps [37];
17
17
  double points [10];
18
18
  char sys = info[3].As<Napi::String>().Utf8Value()[0];
19
- int g = sys == 'G' ? 37 : 13;
20
19
  int flag = swe_houses(
21
20
  info[0].As<Napi::Number>().DoubleValue(),
22
21
  info[1].As<Napi::Number>().DoubleValue(),
@@ -25,6 +24,7 @@ Napi::Value sweph_houses(const Napi::CallbackInfo& info) {
25
24
  cusps,
26
25
  points
27
26
  );
27
+ int g = sys == 'G' && flag == OK ? 37 : 13;
28
28
  Napi::Object data = Napi::Object::New(env);
29
29
  data["houses"] = sweph_js_array_converter(&cusps[1], g-1, env);
30
30
  data["points"] = sweph_js_array_converter(points, 8, env);
@@ -17,7 +17,6 @@ Napi::Value sweph_houses_ex(const Napi::CallbackInfo& info) {
17
17
  double cusps [37];
18
18
  double points [10];
19
19
  char sys = info[4].As<Napi::String>().Utf8Value()[0];
20
- int g = sys == 'G' ? 37 : 13;
21
20
  int flag = swe_houses_ex(
22
21
  info[0].As<Napi::Number>().DoubleValue(),
23
22
  info[1].As<Napi::Number>().Int32Value(),
@@ -27,6 +26,7 @@ Napi::Value sweph_houses_ex(const Napi::CallbackInfo& info) {
27
26
  cusps,
28
27
  points
29
28
  );
29
+ int g = sys == 'G' && flag == OK ? 37 : 13;
30
30
  Napi::Object data = Napi::Object::New(env);
31
31
  data["houses"] = sweph_js_array_converter(&cusps[1], g-1, env);
32
32
  data["points"] = sweph_js_array_converter(points, 8, env);
@@ -20,7 +20,6 @@ Napi::Value sweph_houses_ex2(const Napi::CallbackInfo& info) {
20
20
  double pspeed [10];
21
21
  char serr [AS_MAXCH];
22
22
  char sys = info[4].As<Napi::String>().Utf8Value()[0];
23
- int g = sys == 'G' ? 37 : 13;
24
23
  int flag = swe_houses_ex2(
25
24
  info[0].As<Napi::Number>().DoubleValue(),
26
25
  info[1].As<Napi::Number>().Int32Value(),
@@ -33,6 +32,7 @@ Napi::Value sweph_houses_ex2(const Napi::CallbackInfo& info) {
33
32
  pspeed,
34
33
  serr
35
34
  );
35
+ int g = sys == 'G' && flag == OK ? 37 : 13;
36
36
  Napi::Object data = Napi::Object::New(env);
37
37
  data["houses"] = sweph_js_array_converter(&cusps[1], g-1, env);
38
38
  data["points"] = sweph_js_array_converter(points, 8, env);
package/src/sweph.cpp CHANGED
@@ -114,7 +114,7 @@ bool sweph_is_type(int type, Napi::Value data) {
114
114
 
115
115
  bool sweph_type_check(const std::pair<int, const char*> types[], const Napi::CallbackInfo& info) {
116
116
  Napi::Env env = info.Env();
117
- if(info.Length() < types[0].first) {
117
+ if((int)info.Length() < types[0].first) {
118
118
  Napi::TypeError::New(env, types[0].second).ThrowAsJavaScriptException();
119
119
  return false;
120
120
  }