Thimoteus/alst_core

Apparent Local Sidereal Time (ALST) calculation, written in ReScript. Consumable from both TypeScript and ReScript.

★ 0Forks 0ReScriptGitHub ↗Compare

README

alst_core

Apparent Local Sidereal Time (ALST) calculation, written in ReScript. Consumable from both TypeScript and ReScript.

Install

npm install @thimoteus/alst_core

The package ships its build artifacts (*.res.js, *.gen.js, *.gen.d.ts), so no build step is required in the consumer.

TypeScript

Types are generated by genType; the package's exports map points TypeScript at .d.ts files and the matching .gen.js runtime.

import { alst } from "@thimoteus/alst_core";
import { Deg } from "@thimoteus/alst_core/Angles";

const longitude = Deg.make(-73.9857); // New York City
const [hours, minutes, seconds] = alst(new Date(), longitude);

Available entry points

Import Exports
@thimoteus/alst_core alst(date, long) => [h, m, s]
@thimoteus/alst_core/Angles Deg (with .make), Deg_make, type Deg_t

Only values annotated with @genType in the ReScript source get TypeScript bindings.

ReScript

Add alst_core to your rescript.json:

{
  "bs-dependencies": ["@thimoteus/alst_core"]
}

Then use the modules directly — the full ReScript API is available (not just the @genType-annotated subset):

let longitude = Angles.Deg.make(-73.9857)
let (h, m, s) = ALST.alst(Date.make(), longitude)

// Julian module is available too
let jd = Julian.fromDate(Date.make())

Modules

  • ALST — alst(date, long) returns (hours, minutes, seconds) of Apparent Local Sidereal Time.
  • Angles — Deg and Rad with conversions (toRad, normalize_long, unwrap) and trig (sin, cos).
  • Julian — Julian date arithmetic with fromDate, unwrap, j2000, and operator overloads.

Development

npm run build   # rescript + tsc
npm run dev     # rescript watch
npm test        # rescript build, then node --test on *Test.res.js

Contributors

Thimoteus

Issues