chart2txt 0.6.0 → 0.7.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.
- package/README.md +101 -34
- package/dist/chart2txt.d.ts +9 -0
- package/dist/chart2txt.js +30 -0
- package/dist/chart2txt.min.js +1 -1
- package/dist/config/ChartSettings.d.ts +12 -6
- package/dist/config/ChartSettings.js +36 -11
- package/dist/constants.d.ts +17 -2
- package/dist/constants.js +301 -34
- package/dist/core/analysis.d.ts +6 -0
- package/dist/core/analysis.js +235 -0
- package/dist/core/aspectPatterns.d.ts +8 -3
- package/dist/core/aspectPatterns.js +234 -218
- package/dist/core/aspects.d.ts +14 -11
- package/dist/core/aspects.js +49 -32
- package/dist/core/dignities.d.ts +2 -27
- package/dist/core/dignities.js +56 -121
- package/dist/core/dispositors.d.ts +6 -19
- package/dist/core/dispositors.js +45 -131
- package/dist/core/grouping.d.ts +9 -0
- package/dist/core/grouping.js +45 -0
- package/dist/core/signDistributions.d.ts +20 -30
- package/dist/core/signDistributions.js +22 -122
- package/dist/core/stelliums.d.ts +10 -0
- package/dist/core/stelliums.js +108 -0
- package/dist/formatters/text/sections/aspectPatterns.d.ts +3 -1
- package/dist/formatters/text/sections/aspectPatterns.js +118 -94
- package/dist/formatters/text/sections/aspects.d.ts +3 -6
- package/dist/formatters/text/sections/aspects.js +35 -52
- package/dist/formatters/text/sections/dispositors.d.ts +4 -3
- package/dist/formatters/text/sections/dispositors.js +7 -8
- package/dist/formatters/text/sections/houseOverlays.d.ts +11 -6
- package/dist/formatters/text/sections/houseOverlays.js +37 -44
- package/dist/formatters/text/sections/metadata.d.ts +2 -0
- package/dist/formatters/text/sections/metadata.js +54 -0
- package/dist/formatters/text/sections/planets.d.ts +3 -5
- package/dist/formatters/text/sections/planets.js +11 -22
- package/dist/formatters/text/sections/signDistributions.d.ts +9 -25
- package/dist/formatters/text/sections/signDistributions.js +9 -55
- package/dist/formatters/text/textFormatter.d.ts +4 -5
- package/dist/formatters/text/textFormatter.js +81 -141
- package/dist/index.d.ts +7 -4
- package/dist/index.js +11 -6
- package/dist/types.d.ts +100 -15
- package/dist/types.js +15 -0
- package/dist/utils/formatting.d.ts +4 -0
- package/dist/utils/formatting.js +43 -0
- package/dist/utils/houseCalculations.d.ts +10 -13
- package/dist/utils/houseCalculations.js +15 -57
- package/package.json +1 -1
package/dist/types.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanetCategory = exports.AspectClassification = void 0;
|
|
3
4
|
exports.isMultiChartData = isMultiChartData;
|
|
4
5
|
function isMultiChartData(obj) {
|
|
5
6
|
return Array.isArray(obj);
|
|
6
7
|
}
|
|
8
|
+
var AspectClassification;
|
|
9
|
+
(function (AspectClassification) {
|
|
10
|
+
AspectClassification["Major"] = "major";
|
|
11
|
+
AspectClassification["Minor"] = "minor";
|
|
12
|
+
AspectClassification["Esoteric"] = "esoteric";
|
|
13
|
+
})(AspectClassification || (exports.AspectClassification = AspectClassification = {}));
|
|
14
|
+
var PlanetCategory;
|
|
15
|
+
(function (PlanetCategory) {
|
|
16
|
+
PlanetCategory["Luminaries"] = "luminaries";
|
|
17
|
+
PlanetCategory["Personal"] = "personal";
|
|
18
|
+
PlanetCategory["Social"] = "social";
|
|
19
|
+
PlanetCategory["Outer"] = "outer";
|
|
20
|
+
PlanetCategory["Angles"] = "angles";
|
|
21
|
+
})(PlanetCategory || (exports.PlanetCategory = PlanetCategory = {}));
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { Point, PlanetPosition } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* Converts a number to its ordinal form (1st, 2nd, 3rd, etc.)
|
|
3
4
|
* @param num The number to convert
|
|
4
5
|
* @returns The ordinal string
|
|
5
6
|
*/
|
|
6
7
|
export declare function getOrdinal(num: number): string;
|
|
8
|
+
export declare function getSign(degree: number): string;
|
|
9
|
+
export declare function getHouse(degree: number, houseCusps: number[]): number;
|
|
10
|
+
export declare function getPlanetPositions(planets: Point[], houseCusps?: number[]): PlanetPosition[];
|
package/dist/utils/formatting.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOrdinal = getOrdinal;
|
|
4
|
+
exports.getSign = getSign;
|
|
5
|
+
exports.getHouse = getHouse;
|
|
6
|
+
exports.getPlanetPositions = getPlanetPositions;
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
function normalizeDegree(degree) {
|
|
9
|
+
return ((degree % 360) + 360) % 360;
|
|
10
|
+
}
|
|
4
11
|
/**
|
|
5
12
|
* Converts a number to its ordinal form (1st, 2nd, 3rd, etc.)
|
|
6
13
|
* @param num The number to convert
|
|
@@ -11,3 +18,39 @@ function getOrdinal(num) {
|
|
|
11
18
|
const v = num % 100;
|
|
12
19
|
return num + (suffix[(v - 20) % 10] || suffix[v] || suffix[0]);
|
|
13
20
|
}
|
|
21
|
+
function getSign(degree) {
|
|
22
|
+
const signIndex = Math.floor(degree / 30);
|
|
23
|
+
return constants_1.ZODIAC_SIGNS[signIndex];
|
|
24
|
+
}
|
|
25
|
+
function getHouse(degree, houseCusps) {
|
|
26
|
+
for (let i = 0; i < 12; i++) {
|
|
27
|
+
const cusp1 = houseCusps[i];
|
|
28
|
+
const cusp2 = houseCusps[(i + 1) % 12];
|
|
29
|
+
if (cusp1 < cusp2) {
|
|
30
|
+
if (degree >= cusp1 && degree < cusp2) {
|
|
31
|
+
return i + 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (degree >= cusp1 || degree < cusp2) {
|
|
36
|
+
return i + 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return -1; // Should not happen
|
|
41
|
+
}
|
|
42
|
+
function getPlanetPositions(planets, houseCusps) {
|
|
43
|
+
return planets.map((planet) => {
|
|
44
|
+
const normalizedDegree = normalizeDegree(planet.degree);
|
|
45
|
+
const position = {
|
|
46
|
+
name: planet.name,
|
|
47
|
+
degree: normalizedDegree,
|
|
48
|
+
sign: getSign(normalizedDegree),
|
|
49
|
+
speed: planet.speed,
|
|
50
|
+
};
|
|
51
|
+
if (houseCusps) {
|
|
52
|
+
position.house = getHouse(normalizedDegree, houseCusps);
|
|
53
|
+
}
|
|
54
|
+
return position;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @returns House number (1-12) or null if calculation fails
|
|
12
|
-
*/
|
|
13
|
-
export declare function getHouseForPoint(pointDegree: number, houseCusps: number[] | undefined): number | null;
|
|
1
|
+
import { ChartData } from '../types';
|
|
2
|
+
export declare function calculateHouseOverlays(chart1: ChartData, chart2: ChartData): {
|
|
3
|
+
chart1InChart2Houses: {
|
|
4
|
+
[key: string]: number;
|
|
5
|
+
};
|
|
6
|
+
chart2InChart1Houses: {
|
|
7
|
+
[key: string]: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare function getHouseForPoint(degree: number, houseCusps: number[]): number;
|
|
@@ -1,65 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateHouseOverlays = calculateHouseOverlays;
|
|
4
4
|
exports.getHouseForPoint = getHouseForPoint;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
function validateHouseCusps(houseCusps) {
|
|
13
|
-
if (!houseCusps || houseCusps.length !== 12) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
// Check that all cusp values are finite numbers
|
|
17
|
-
for (const cusp of houseCusps) {
|
|
18
|
-
if (!isFinite(cusp)) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Determines which house a point falls into based on house cusps
|
|
26
|
-
* @param pointDegree The degree of the point (will be normalized)
|
|
27
|
-
* @param houseCusps Array of 12 house cusp degrees
|
|
28
|
-
* @returns House number (1-12) or null if calculation fails
|
|
29
|
-
*/
|
|
30
|
-
function getHouseForPoint(pointDegree, houseCusps) {
|
|
31
|
-
if (!validateHouseCusps(houseCusps)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
if (!isFinite(pointDegree)) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const normalizedPoint = (0, precision_1.roundDegrees)((0, astrology_1.normalizeDegree)(pointDegree));
|
|
38
|
-
const normalizedCusps = houseCusps.map((cusp) => (0, precision_1.roundDegrees)((0, astrology_1.normalizeDegree)(cusp)));
|
|
39
|
-
// Check if point is exactly on any cusp (within precision tolerance)
|
|
40
|
-
for (let i = 0; i < 12; i++) {
|
|
41
|
-
if ((0, precision_1.isOnCusp)(normalizedPoint, normalizedCusps[i])) {
|
|
42
|
-
// Point is exactly on cusp - assign to the house that starts at this cusp
|
|
43
|
-
return i + 1;
|
|
5
|
+
const formatting_1 = require("./formatting");
|
|
6
|
+
function calculateHouseOverlays(chart1, chart2) {
|
|
7
|
+
const chart1InChart2Houses = {};
|
|
8
|
+
if (chart2.houseCusps) {
|
|
9
|
+
for (const planet of chart1.planets) {
|
|
10
|
+
chart1InChart2Houses[planet.name] = (0, formatting_1.getHouse)(planet.degree, chart2.houseCusps);
|
|
44
11
|
}
|
|
45
12
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
// Normal case: cusp doesn't cross 0° boundary
|
|
51
|
-
if (normalizedPoint > cuspStart && normalizedPoint < cuspEnd) {
|
|
52
|
-
return i + 1;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// Wraparound case: cusp crosses 0°/360° boundary
|
|
57
|
-
if (normalizedPoint > cuspStart || normalizedPoint < cuspEnd) {
|
|
58
|
-
return i + 1;
|
|
59
|
-
}
|
|
13
|
+
const chart2InChart1Houses = {};
|
|
14
|
+
if (chart1.houseCusps) {
|
|
15
|
+
for (const planet of chart2.planets) {
|
|
16
|
+
chart2InChart1Houses[planet.name] = (0, formatting_1.getHouse)(planet.degree, chart1.houseCusps);
|
|
60
17
|
}
|
|
61
18
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
19
|
+
return { chart1InChart2Houses, chart2InChart1Houses };
|
|
20
|
+
}
|
|
21
|
+
function getHouseForPoint(degree, houseCusps) {
|
|
22
|
+
return (0, formatting_1.getHouse)(degree, houseCusps);
|
|
65
23
|
}
|