@swisseph/node 1.2.0 → 1.2.2
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/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EAEZ,aAAa,EACb,WAAW,EAEX,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EAQf,MAAM,gBAAgB,CAAC;AAkCxB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAU3D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAU,EAChB,YAAY,GAAE,YAAqC,GAClD,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EAEZ,aAAa,EACb,WAAW,EAEX,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EAQf,MAAM,gBAAgB,CAAC;AAkCxB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAU3D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IA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ACjB,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,oBAAqD,EAC5D,mBAAmB,GAAE,MAAU,EAC/B,sBAAsB,GAAE,MAAU,GACjC,cAAc,CAqBhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAGD,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -131,6 +131,11 @@ function setEphemerisPath(path) {
|
|
|
131
131
|
* console.log(jdWithTime); // 2454163.104166667
|
|
132
132
|
*/
|
|
133
133
|
function julianDay(year, month, day, hour = 0, calendarType = core_1.CalendarType.Gregorian) {
|
|
134
|
+
// Validate inputs are valid numbers
|
|
135
|
+
if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day) || !Number.isFinite(hour)) {
|
|
136
|
+
throw new TypeError(`julianDay requires finite numbers. Received: ` +
|
|
137
|
+
`year=${year}, month=${month}, day=${day}, hour=${hour}`);
|
|
138
|
+
}
|
|
134
139
|
return binding.julday(year, month, day, hour, calendarType);
|
|
135
140
|
}
|
|
136
141
|
/**
|
|
@@ -156,6 +161,10 @@ function julianDay(year, month, day, hour = 0, calendarType = core_1.CalendarTyp
|
|
|
156
161
|
* const jd2 = dateToJulianDay(new Date(Date.UTC(1990, 4, 15, 14, 30)));
|
|
157
162
|
*/
|
|
158
163
|
function dateToJulianDay(date, calendarType = core_1.CalendarType.Gregorian) {
|
|
164
|
+
// Validate that the date object is valid
|
|
165
|
+
if (!(date instanceof Date)) {
|
|
166
|
+
throw new TypeError('dateToJulianDay expects a Date object');
|
|
167
|
+
}
|
|
159
168
|
const year = date.getUTCFullYear();
|
|
160
169
|
const month = date.getUTCMonth() + 1; // JavaScript months are 0-indexed
|
|
161
170
|
const day = date.getUTCDate();
|
|
@@ -163,6 +172,12 @@ function dateToJulianDay(date, calendarType = core_1.CalendarType.Gregorian) {
|
|
|
163
172
|
const minutes = date.getUTCMinutes();
|
|
164
173
|
const seconds = date.getUTCSeconds();
|
|
165
174
|
const milliseconds = date.getUTCMilliseconds();
|
|
175
|
+
// Check if date is invalid (results in NaN)
|
|
176
|
+
if (isNaN(year) || isNaN(month) || isNaN(day) || isNaN(hours)) {
|
|
177
|
+
throw new TypeError(`Invalid Date object provided to dateToJulianDay. ` +
|
|
178
|
+
`Date.toString() returned: "${date.toString()}". ` +
|
|
179
|
+
`Please ensure the date is valid (e.g., avoid new Date("invalid")).`);
|
|
180
|
+
}
|
|
166
181
|
// Convert to decimal hours
|
|
167
182
|
const decimalHours = hours + minutes / 60 + seconds / 3600 + milliseconds / 3600000;
|
|
168
183
|
return julianDay(year, month, day, decimalHours, calendarType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swisseph/node",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Swiss Ephemeris for Node.js - high precision astronomical calculations with native bindings",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"astrology",
|
|
28
28
|
"ephemeris",
|
|
29
29
|
"swiss-ephemeris",
|
|
30
|
+
"swisseph",
|
|
31
|
+
"sweph",
|
|
30
32
|
"planets",
|
|
31
33
|
"celestial",
|
|
32
34
|
"julian-day",
|
|
33
35
|
"typescript",
|
|
34
|
-
"native"
|
|
35
|
-
"nodejs"
|
|
36
|
+
"native"
|
|
36
37
|
],
|
|
37
38
|
"author": "",
|
|
38
39
|
"license": "AGPL-3.0",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"node-addon-api": "^7.1.0",
|
|
53
54
|
"node-gyp-build": "^4.8.4",
|
|
54
|
-
"@swisseph/core": "1.1.
|
|
55
|
+
"@swisseph/core": "1.1.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/jest": "^29.5.11",
|
|
Binary file
|
|
Binary file
|