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.
@@ -3087,6 +3087,7 @@ var BODY = {
3087
3087
  MEAN_APOGEE: 12,
3088
3088
  // Lilith mean
3089
3089
  OSC_APOGEE: 13};
3090
+ var normalizeAngle = (deg) => (deg % 360 + 360) % 360;
3090
3091
  var SwissEph = class {
3091
3092
  /**
3092
3093
  * Constructor that accepts a pre-initialized Swiss Ephemeris module
@@ -3316,11 +3317,11 @@ async function calculatePlanetaryPositions(date) {
3316
3317
  neptune: 8 /* NEPTUNE */,
3317
3318
  pluto: 9 /* PLUTO */,
3318
3319
  meanNode: 10 /* MEAN_NODE */,
3319
- trueNode: 11 /* TRUE_NODE */,
3320
+ // trueNode: Planet.TRUE_NODE,
3320
3321
  // TODO: add chiron through seas_18.se1, seas_18.se2 and seasnam.txt files
3321
3322
  // chiron: Planet.CHIRON,
3322
- lilithMean: 12 /* LILITH_MEAN */,
3323
- lilithTrue: 13 /* LILITH_TRUE */
3323
+ lilithMean: 12 /* LILITH_MEAN */
3324
+ // lilithTrue: Planet.LILITH_TRUE,
3324
3325
  };
3325
3326
  const positions = {};
3326
3327
  for (const [name, id] of Object.entries(planets)) {
@@ -3406,36 +3407,65 @@ async function getBirthChart(options) {
3406
3407
  throw error;
3407
3408
  }
3408
3409
  }
3410
+ var SIGNS = [
3411
+ "Aries",
3412
+ "Taurus",
3413
+ "Gemini",
3414
+ "Cancer",
3415
+ "Leo",
3416
+ "Virgo",
3417
+ "Libra",
3418
+ "Scorpio",
3419
+ "Sagittarius",
3420
+ "Capricorn",
3421
+ "Aquarius",
3422
+ "Pisces"
3423
+ ];
3409
3424
  function formatDegreeMinutes(decimalDegrees) {
3410
- const degrees = Math.floor(decimalDegrees);
3411
- const minutes = Math.round((decimalDegrees - degrees) * 60);
3412
- return `${degrees}\xB0${minutes.toString().padStart(2, "0")}'`;
3425
+ let deg = Math.floor(decimalDegrees);
3426
+ let min = Math.round((decimalDegrees - deg) * 60);
3427
+ if (min === 60) {
3428
+ min = 0;
3429
+ deg += 1;
3430
+ }
3431
+ return `${deg}\xB0${String(min).padStart(2, "0")}'`;
3413
3432
  }
3414
3433
  function getZodiacPosition(longitude) {
3415
- const signs = [
3416
- "Aries",
3417
- "Taurus",
3418
- "Gemini",
3419
- "Cancer",
3420
- "Leo",
3421
- "Virgo",
3422
- "Libra",
3423
- "Scorpio",
3424
- "Sagittarius",
3425
- "Capricorn",
3426
- "Aquarius",
3427
- "Pisces"
3428
- ];
3429
- const signIndex = Math.floor(longitude / 30) % 12;
3430
- const degrees = longitude % 30;
3434
+ const L = normalizeAngle(longitude);
3435
+ const signIndex = Math.floor(L / 30) % 12;
3436
+ const within = L - signIndex * 30;
3431
3437
  return {
3432
- sign: signs[signIndex],
3433
- decimalDegrees: degrees,
3434
- traditionalFormat: formatDegreeMinutes(degrees),
3435
- decimal: degrees.toFixed(2) + "\xB0"
3438
+ sign: SIGNS[signIndex],
3439
+ decimalDegrees: within,
3440
+ traditionalFormat: formatDegreeMinutes(within),
3441
+ decimal: within.toFixed(2) + "\xB0"
3436
3442
  };
3437
3443
  }
3444
+ function formatHouseCusps(houses360) {
3445
+ return houses360.map((lon, i) => {
3446
+ const z = getZodiacPosition(lon);
3447
+ return {
3448
+ house: i + 1,
3449
+ sign: z.sign,
3450
+ degree: z.traditionalFormat,
3451
+ longitude: normalizeAngle(lon)
3452
+ };
3453
+ });
3454
+ }
3455
+ function findHouseOf(longitude, cusps360) {
3456
+ const L = normalizeAngle(longitude);
3457
+ const H = cusps360.map((c, i) => ({ i: i + 1, L: normalizeAngle(c) })).sort((a, b) => a.L - b.L);
3458
+ for (let k = 0; k < H.length; k++) {
3459
+ const cur = H[k], nxt = H[(k + 1) % H.length];
3460
+ if (nxt.L < cur.L) {
3461
+ if (L >= cur.L || L < nxt.L) return cur.i;
3462
+ } else {
3463
+ if (L >= cur.L && L < nxt.L) return cur.i;
3464
+ }
3465
+ }
3466
+ return 1;
3467
+ }
3438
3468
 
3439
- export { CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition };
3440
- //# sourceMappingURL=chunk-O2LE2NXP.mjs.map
3441
- //# sourceMappingURL=chunk-O2LE2NXP.mjs.map
3469
+ export { CalcFlag, HouseSystem, Planet, SIGNS, closeSwissEph, findHouseOf, formatDegreeMinutes, formatHouseCusps, getBirthChart, getSwissEph, getZodiacPosition, normalizeAngle };
3470
+ //# sourceMappingURL=chunk-T7D3HPJZ.mjs.map
3471
+ //# sourceMappingURL=chunk-T7D3HPJZ.mjs.map