kaabalah 3.2.0 → 3.3.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.
@@ -46,6 +46,7 @@ declare enum CalcFlag {
46
46
  TOPOCTR = 32768,
47
47
  SIDEREAL = 65536
48
48
  }
49
+ declare const normalizeAngle: (deg: number) => number;
49
50
 
50
51
  /**
51
52
  * Initializes and returns the Swiss Ephemeris instance.
@@ -95,6 +96,7 @@ interface BirthChart {
95
96
  * @returns Birth chart data
96
97
  */
97
98
  declare function getBirthChart(options: BirthChartOptions): Promise<BirthChart>;
99
+ declare const SIGNS: readonly ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"];
98
100
  /**
99
101
  * Convert decimal degrees to degrees and minutes format
100
102
  *
@@ -114,5 +116,12 @@ declare function getZodiacPosition(longitude: number): {
114
116
  traditionalFormat: string;
115
117
  decimal: string;
116
118
  };
119
+ declare function formatHouseCusps(houses360: number[]): {
120
+ house: number;
121
+ sign: string;
122
+ degree: string;
123
+ longitude: number;
124
+ }[];
125
+ declare function findHouseOf(longitude: number, cusps360: number[]): number;
117
126
 
118
- export { type BirthChart, type BirthChartOptions, CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition };
127
+ export { type BirthChart, type BirthChartOptions, CalcFlag, HouseSystem, Planet, SIGNS, closeSwissEph, findHouseOf, formatDegreeMinutes, formatHouseCusps, getBirthChart, getSwissEph, getZodiacPosition, normalizeAngle };
@@ -46,6 +46,7 @@ declare enum CalcFlag {
46
46
  TOPOCTR = 32768,
47
47
  SIDEREAL = 65536
48
48
  }
49
+ declare const normalizeAngle: (deg: number) => number;
49
50
 
50
51
  /**
51
52
  * Initializes and returns the Swiss Ephemeris instance.
@@ -95,6 +96,7 @@ interface BirthChart {
95
96
  * @returns Birth chart data
96
97
  */
97
98
  declare function getBirthChart(options: BirthChartOptions): Promise<BirthChart>;
99
+ declare const SIGNS: readonly ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"];
98
100
  /**
99
101
  * Convert decimal degrees to degrees and minutes format
100
102
  *
@@ -114,5 +116,12 @@ declare function getZodiacPosition(longitude: number): {
114
116
  traditionalFormat: string;
115
117
  decimal: string;
116
118
  };
119
+ declare function formatHouseCusps(houses360: number[]): {
120
+ house: number;
121
+ sign: string;
122
+ degree: string;
123
+ longitude: number;
124
+ }[];
125
+ declare function findHouseOf(longitude: number, cusps360: number[]): number;
117
126
 
118
- export { type BirthChart, type BirthChartOptions, CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition };
127
+ export { type BirthChart, type BirthChartOptions, CalcFlag, HouseSystem, Planet, SIGNS, closeSwissEph, findHouseOf, formatDegreeMinutes, formatHouseCusps, getBirthChart, getSwissEph, getZodiacPosition, normalizeAngle };
@@ -1,41 +1,57 @@
1
1
  'use strict';
2
2
 
3
- var chunk3JIIZ45K_js = require('../chunk-3JIIZ45K.js');
3
+ var chunkKU4LMTWD_js = require('../chunk-KU4LMTWD.js');
4
4
  require('../chunk-2TUXWMP5.js');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "CalcFlag", {
9
9
  enumerable: true,
10
- get: function () { return chunk3JIIZ45K_js.CalcFlag; }
10
+ get: function () { return chunkKU4LMTWD_js.CalcFlag; }
11
11
  });
12
12
  Object.defineProperty(exports, "HouseSystem", {
13
13
  enumerable: true,
14
- get: function () { return chunk3JIIZ45K_js.HouseSystem; }
14
+ get: function () { return chunkKU4LMTWD_js.HouseSystem; }
15
15
  });
16
16
  Object.defineProperty(exports, "Planet", {
17
17
  enumerable: true,
18
- get: function () { return chunk3JIIZ45K_js.Planet; }
18
+ get: function () { return chunkKU4LMTWD_js.Planet; }
19
+ });
20
+ Object.defineProperty(exports, "SIGNS", {
21
+ enumerable: true,
22
+ get: function () { return chunkKU4LMTWD_js.SIGNS; }
19
23
  });
20
24
  Object.defineProperty(exports, "closeSwissEph", {
21
25
  enumerable: true,
22
- get: function () { return chunk3JIIZ45K_js.closeSwissEph; }
26
+ get: function () { return chunkKU4LMTWD_js.closeSwissEph; }
27
+ });
28
+ Object.defineProperty(exports, "findHouseOf", {
29
+ enumerable: true,
30
+ get: function () { return chunkKU4LMTWD_js.findHouseOf; }
23
31
  });
24
32
  Object.defineProperty(exports, "formatDegreeMinutes", {
25
33
  enumerable: true,
26
- get: function () { return chunk3JIIZ45K_js.formatDegreeMinutes; }
34
+ get: function () { return chunkKU4LMTWD_js.formatDegreeMinutes; }
35
+ });
36
+ Object.defineProperty(exports, "formatHouseCusps", {
37
+ enumerable: true,
38
+ get: function () { return chunkKU4LMTWD_js.formatHouseCusps; }
27
39
  });
28
40
  Object.defineProperty(exports, "getBirthChart", {
29
41
  enumerable: true,
30
- get: function () { return chunk3JIIZ45K_js.getBirthChart; }
42
+ get: function () { return chunkKU4LMTWD_js.getBirthChart; }
31
43
  });
32
44
  Object.defineProperty(exports, "getSwissEph", {
33
45
  enumerable: true,
34
- get: function () { return chunk3JIIZ45K_js.getSwissEph; }
46
+ get: function () { return chunkKU4LMTWD_js.getSwissEph; }
35
47
  });
36
48
  Object.defineProperty(exports, "getZodiacPosition", {
37
49
  enumerable: true,
38
- get: function () { return chunk3JIIZ45K_js.getZodiacPosition; }
50
+ get: function () { return chunkKU4LMTWD_js.getZodiacPosition; }
51
+ });
52
+ Object.defineProperty(exports, "normalizeAngle", {
53
+ enumerable: true,
54
+ get: function () { return chunkKU4LMTWD_js.normalizeAngle; }
39
55
  });
40
56
  //# sourceMappingURL=index.js.map
41
57
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- export { CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition } from '../chunk-O2LE2NXP.mjs';
1
+ export { CalcFlag, HouseSystem, Planet, SIGNS, closeSwissEph, findHouseOf, formatDegreeMinutes, formatHouseCusps, getBirthChart, getSwissEph, getZodiacPosition, normalizeAngle } from '../chunk-T7D3HPJZ.mjs';
2
2
  import '../chunk-PY5SMMJB.mjs';
3
3
  //# sourceMappingURL=index.mjs.map
4
4
  //# sourceMappingURL=index.mjs.map
@@ -3089,6 +3089,7 @@ var BODY = {
3089
3089
  MEAN_APOGEE: 12,
3090
3090
  // Lilith mean
3091
3091
  OSC_APOGEE: 13};
3092
+ var normalizeAngle = (deg) => (deg % 360 + 360) % 360;
3092
3093
  var SwissEph = class {
3093
3094
  /**
3094
3095
  * Constructor that accepts a pre-initialized Swiss Ephemeris module
@@ -3318,11 +3319,11 @@ async function calculatePlanetaryPositions(date) {
3318
3319
  neptune: 8 /* NEPTUNE */,
3319
3320
  pluto: 9 /* PLUTO */,
3320
3321
  meanNode: 10 /* MEAN_NODE */,
3321
- trueNode: 11 /* TRUE_NODE */,
3322
+ // trueNode: Planet.TRUE_NODE,
3322
3323
  // TODO: add chiron through seas_18.se1, seas_18.se2 and seasnam.txt files
3323
3324
  // chiron: Planet.CHIRON,
3324
- lilithMean: 12 /* LILITH_MEAN */,
3325
- lilithTrue: 13 /* LILITH_TRUE */
3325
+ lilithMean: 12 /* LILITH_MEAN */
3326
+ // lilithTrue: Planet.LILITH_TRUE,
3326
3327
  };
3327
3328
  const positions = {};
3328
3329
  for (const [name, id] of Object.entries(planets)) {
@@ -3408,43 +3409,76 @@ async function getBirthChart(options) {
3408
3409
  throw error;
3409
3410
  }
3410
3411
  }
3412
+ var SIGNS = [
3413
+ "Aries",
3414
+ "Taurus",
3415
+ "Gemini",
3416
+ "Cancer",
3417
+ "Leo",
3418
+ "Virgo",
3419
+ "Libra",
3420
+ "Scorpio",
3421
+ "Sagittarius",
3422
+ "Capricorn",
3423
+ "Aquarius",
3424
+ "Pisces"
3425
+ ];
3411
3426
  function formatDegreeMinutes(decimalDegrees) {
3412
- const degrees = Math.floor(decimalDegrees);
3413
- const minutes = Math.round((decimalDegrees - degrees) * 60);
3414
- return `${degrees}\xB0${minutes.toString().padStart(2, "0")}'`;
3427
+ let deg = Math.floor(decimalDegrees);
3428
+ let min = Math.round((decimalDegrees - deg) * 60);
3429
+ if (min === 60) {
3430
+ min = 0;
3431
+ deg += 1;
3432
+ }
3433
+ return `${deg}\xB0${String(min).padStart(2, "0")}'`;
3415
3434
  }
3416
3435
  function getZodiacPosition(longitude) {
3417
- const signs = [
3418
- "Aries",
3419
- "Taurus",
3420
- "Gemini",
3421
- "Cancer",
3422
- "Leo",
3423
- "Virgo",
3424
- "Libra",
3425
- "Scorpio",
3426
- "Sagittarius",
3427
- "Capricorn",
3428
- "Aquarius",
3429
- "Pisces"
3430
- ];
3431
- const signIndex = Math.floor(longitude / 30) % 12;
3432
- const degrees = longitude % 30;
3436
+ const L = normalizeAngle(longitude);
3437
+ const signIndex = Math.floor(L / 30) % 12;
3438
+ const within = L - signIndex * 30;
3433
3439
  return {
3434
- sign: signs[signIndex],
3435
- decimalDegrees: degrees,
3436
- traditionalFormat: formatDegreeMinutes(degrees),
3437
- decimal: degrees.toFixed(2) + "\xB0"
3440
+ sign: SIGNS[signIndex],
3441
+ decimalDegrees: within,
3442
+ traditionalFormat: formatDegreeMinutes(within),
3443
+ decimal: within.toFixed(2) + "\xB0"
3438
3444
  };
3439
3445
  }
3446
+ function formatHouseCusps(houses360) {
3447
+ return houses360.map((lon, i) => {
3448
+ const z = getZodiacPosition(lon);
3449
+ return {
3450
+ house: i + 1,
3451
+ sign: z.sign,
3452
+ degree: z.traditionalFormat,
3453
+ longitude: normalizeAngle(lon)
3454
+ };
3455
+ });
3456
+ }
3457
+ function findHouseOf(longitude, cusps360) {
3458
+ const L = normalizeAngle(longitude);
3459
+ const H = cusps360.map((c, i) => ({ i: i + 1, L: normalizeAngle(c) })).sort((a, b) => a.L - b.L);
3460
+ for (let k = 0; k < H.length; k++) {
3461
+ const cur = H[k], nxt = H[(k + 1) % H.length];
3462
+ if (nxt.L < cur.L) {
3463
+ if (L >= cur.L || L < nxt.L) return cur.i;
3464
+ } else {
3465
+ if (L >= cur.L && L < nxt.L) return cur.i;
3466
+ }
3467
+ }
3468
+ return 1;
3469
+ }
3440
3470
 
3441
3471
  exports.CalcFlag = CalcFlag;
3442
3472
  exports.HouseSystem = HouseSystem;
3443
3473
  exports.Planet = Planet;
3474
+ exports.SIGNS = SIGNS;
3444
3475
  exports.closeSwissEph = closeSwissEph;
3476
+ exports.findHouseOf = findHouseOf;
3445
3477
  exports.formatDegreeMinutes = formatDegreeMinutes;
3478
+ exports.formatHouseCusps = formatHouseCusps;
3446
3479
  exports.getBirthChart = getBirthChart;
3447
3480
  exports.getSwissEph = getSwissEph;
3448
3481
  exports.getZodiacPosition = getZodiacPosition;
3449
- //# sourceMappingURL=chunk-3JIIZ45K.js.map
3450
- //# sourceMappingURL=chunk-3JIIZ45K.js.map
3482
+ exports.normalizeAngle = normalizeAngle;
3483
+ //# sourceMappingURL=chunk-KU4LMTWD.js.map
3484
+ //# sourceMappingURL=chunk-KU4LMTWD.js.map