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-astrologyQuick start
import { formatChannelOutputs, formatRulingPlanets, 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(formatChannelOutputs(chart))
console.log(formatChannelOutputs(chart, { numerals: "thai" }))API surface
The library re-exports the detailed helpers located in engine/astro-calculation as first-class public functions. Key types include:
calculateAllPositions(input)→ returnsCalculationResultwith 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.formatChannelOutputs(chart, options?)→ create display-ready strings for each of the 12 channels (supports Thai or Arabic numerals).generateThaiAstrologyChart(input)→ convenience wrapper that augmentsCalculationResultwith optionalrulingPlanetsdata.
Refer to the declaration files in dist/ after building for the complete TypeScript surface.
Building locally
npm install
npm run buildA successful build emits compiled JavaScript and declarations into dist/.
License
MIT © Contributors