Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import tables from "./vedic-chart-tables.json";
|
|
|
|
export type VargaDignity = "exalted" | "own" | "debilitated";
|
|
|
|
const EXALTATION: Readonly<Record<string, string>> = tables.exaltation;
|
|
const DEBILITATION: Readonly<Record<string, string>> = tables.debilitation;
|
|
const SIGN_LORDS: Readonly<Record<string, string>> = tables.signLords;
|
|
const NODE_OWN_SIGN: Readonly<Record<string, string>> = tables.nodeOwnSign;
|
|
const VARGA_MEANING: Readonly<Record<string, string>> = tables.vargaMeaning;
|
|
|
|
/**
|
|
* Sign dignity of a body inside a divisional chart.
|
|
*
|
|
* Same precedence as `jyotish_engine._get_dignity_level` (exalted, then own
|
|
* sign, then debilitated) without the parts that need a D1 degree or the whole
|
|
* chart: no moolatrikona band, no neecha bhanga, no friendship. The tables are
|
|
* the engine's; `tests/test_chart_page_vedic_tables_contract.py` pins them.
|
|
*/
|
|
export function vargaDignity(planet: string, sign: string): VargaDignity | null {
|
|
if (EXALTATION[planet] === sign) return "exalted";
|
|
if (SIGN_LORDS[sign] === planet || NODE_OWN_SIGN[planet] === sign) return "own";
|
|
if (DEBILITATION[planet] === sign) return "debilitated";
|
|
return null;
|
|
}
|
|
|
|
export const VARGA_DIGNITY_LABEL: Record<VargaDignity, string> = {
|
|
exalted: "入旺",
|
|
own: "自宫",
|
|
debilitated: "落陷",
|
|
};
|
|
|
|
/** The engine's own one-line use of a D-number chart (`VargaType.meaning`). */
|
|
export function vargaMeaning(division: number): string | null {
|
|
return VARGA_MEANING[String(division)] ?? null;
|
|
}
|