npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@astrologer/astro-core

v1.0.1

Published

A **functional**, high-precision astrological calculation library powered by Swiss Ephemeris. This library provides pure functions for calculating charts, analyzing relationships, and generating ephemerides.

Readme

@astrologer/astro-core

A functional, high-precision astrological calculation library powered by Swiss Ephemeris. This library provides pure functions for calculating charts, analyzing relationships, and generating ephemerides.

Philosophy

  • Functional: All functions are pure and stateless. Inputs -> Outputs.
  • Precision: Uses @swisseph/core for astronomical accuracy.
  • Type-Safe: First-class TypeScript support with comprehensive types.

Installation

pnpm install @astrologer/astro-core

Initialization

Before performing any calculations, you must initialize the library with the appropriate Swiss Ephemeris adapter.

Node.js

import { setSwissEphemeris } from '@astrologer/astro-core';
import * as swe from '@swisseph/node';

// Initialize with the Node.js adapter
setSwissEphemeris(swe);

Browser

import { setSwissEphemeris } from '@astrologer/astro-core';
import { SwissEphemeris } from '@swisseph/browser';

const swe = new SwissEphemeris();
await swe.init(); // WASM initialization
setSwissEphemeris(swe);

Main API

calculateChart(input: ChartInput): ChartData

The primary entry point. Calculates a complete astrological chart snapshot.

import { calculateChart } from '@astrologer/astro-core';

const chart = calculateChart({
  date: '2026-01-01T12:00:00Z',
  location: { latitude: 40.7, longitude: -74.0 }
});

Core Functions

These functions are used internally by calculateChart but can be used independently for granular control.

Planets & Points

  • calculatePlanets(jd, houses, angles, flags?, bodies?): Calculates positions for specified bodies.
  • calculateLunarPhase(sunLon, moonLon): Returns moon phase, illumination, and age.
  • getBodyPosition(body, jd, flags?): Low-level wrapper for Swiss Ephemeris position.

Houses & Angles

  • calculateHousesAndAngles(jd, lat, lng, system): Returns house cusps (1-12) and angles (Asc, MC, Vertex, etc).
  • getHouses(jd, lat, lng, system): Low-level wrapper for Swiss Ephemeris houses.

Aspects

  • calculateAspects(bodies): Finds all major aspects between a list of bodies.
  • calculateDualAspects(bodiesA, bodiesB): Finds aspects between two different sets of bodies (Synastry/Transit).
  • getAspect(body1, body2): Checks if two specific bodies form an aspect.

Advanced Charts

Synastry & Relationships

  • calculateCompositeChart(dateA, locA, dateB, locB): Calculates a midpoint composite chart.
  • calculateRelationshipScore(chartA, chartB): (Analysis) Returns a compatibility score based on synastry aspects.

Forecasting

  • calculateSolarReturn(birthDate, returnYear, location): Calculates the exact moment of the Solar Return.
  • calculateLunarReturn(birthDate, returnDate, location): Calculates the Lunar Return.
  • generateEphemerisRange(input): Generates a time-series of chart data over a date range.

Analysis

  • calculateElementDistribution(bodies): Returns the count/percentage of planets in Fire, Earth, Air, Water.
  • calculateQualityDistribution(bodies): Returns the count/percentage of planets in Cardinal, Fixed, Mutable.
  • calculatePolarityDistribution(bodies): Returns the count/percentage of planets in Yin (Feminine) vs Yang (Masculine).

Utilities

  • getJulianDay(date): Converts string/Date/DateTime to Julian Day Number.
  • findNextEclipse(date, type): Finds the next Solar or Lunar eclipse.
  • configureSidereal(mode): Sets the global sidereal mode (e.g., Fagan-Bradley, Lahiri).
  • configureTopocentric(location): Sets the global topocentric observer location.

Types & Enums

Import these to ensure type safety in your application.

import { 
  BodyId,       // Sun, Moon, Mercury...
  HouseSystem,  // Placidus, Koch, WholeSign...
  AspectType,   // Conjunction, Square...
  ZodiacType    // Tropical, Sidereal
} from '@astrologer/astro-core';