Package Exports
- thai-astrology
Readme
Thai Astrology
Thai Astrology is a TypeScript-first library that implements traditional Thai astrological calculations. It exposes precise planetary position helpers and rulership utilities derived from the historic algorithms contained in engine/astro-calculation
.
Features
- Compute ascendant, planetary positions, and Tanuseth value from Thai-style inputs.
- Derive formatted channel outputs that mimic classical Thai charts.
- Identify ruling planets directly from channel outputs.
- Zero runtime dependencies and full TypeScript declarations.
Installation
npm install thai-astrology
Quick start
import { generateThaiAstrologyChart } from "thai-astrology"
const chart = generateThaiAstrologyChart({
day: 15,
monthTh: "กันยายน",
yearBe: 2566,
hour: 14,
minute: 45,
province: "กรุงเทพมหานคร",
})
console.log(chart.positions.sun) // 5 => สิงห์
console.log(chart.sunPosition) // [29, 12]
console.log(chart.rulingPlanetsText)
API surface
The library re-exports the detailed helpers located in engine/astro-calculation
as first-class public functions. Key types include:
calculateAllPositions(input)
→ returnsCalculationResult
with all planetary placements and channel outputs.calculateAscendant(...)
,calculateSun(...)
, etc. → granular planet calculators.calculateTanuseth(positions, ascSign)
→ compute Tanuseth from placements.findRulingPlanets(chart)
andformatRulingPlanets(info)
→ inspect channel strings for rulership insights.generateThaiAstrologyChart(input)
→ convenience wrapper that augmentsCalculationResult
with optional rulership details.
Refer to the declaration files in dist/
after building for the complete TypeScript surface.
Building locally
npm install
npm run build
A successful build emits compiled JavaScript and declarations into dist/
.
License
MIT © Contributors