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

bazi.js

v1.1.0

Published

一个功能完整的八字命理分析库,支持四柱排盘、五行分析、十神配置、神煞、大运流年等全面分析功能 | A comprehensive Bazi (Chinese astrology) analysis library with full support for four pillars, Wu Xing analysis, Shi Shen, Shen Sha (50+ stars), and Da Yun/Liu Nian predictions

Readme


English

A comprehensive TypeScript/JavaScript library for Chinese astrology (BaZi/Four Pillars of Destiny) analysis.

✨ Features

  • 🎯 Complete BaZi Analysis - Four Pillars, Heavenly Stems & Earthly Branches
  • Five Elements (五行) - Strength calculation and balance analysis
  • 🔮 Ten Gods (十神) - Automatic configuration
  • ⚖️ Day Master Strength - Strong/weak determination
  • 🌟 Favorable Elements - 喜用神 and 忌神 calculation
  • 📅 Luck Cycles - 大运, 流年, 流月, 流日, 小运
  • 🔄 Twelve Life Stages - 十二长生 analysis
  • 🏮 Shen Sha (神煞) - 50+ traditional spirit and sha stars
  • 📚 TypeScript Support - Full type definitions

📦 Installation

npm install bazi.js

🚀 Quick Start

import { Bazi } from 'bazi.js';

const bazi = new Bazi({
  year: 1994,
  month: 2,
  day: 2,
  hour: 11,
  minute: 10,
  gender: 'male',
});

// Basic Info
console.log('BaZi:', bazi.toString());
console.log('Day Master:', bazi.getDayMaster());

// Five Elements
console.log('Five Elements:', bazi.getWuXingStrength());

// Day Master Analysis
const analysis = bazi.getStrengthAnalysis();
console.log('Strong/Weak:', analysis.isStrong ? 'Strong' : 'Weak');

// Favorable Elements
const yongShen = bazi.getYongShenAnalysis();
console.log('Favorable:', yongShen.xiYongShen);

// Shen Sha Analysis
const shenSha = bazi.getShenShaAnalysis();
console.log('Auspicious:', shenSha.auspicious.map(s => s.name));

// Luck Cycles
const daYunList = bazi.getDaYunList();
console.log('Major Luck:', daYunList);

中文

功能完整的八字命理分析 TypeScript/JavaScript 库。

✨ 特性

  • 🎯 完整八字分析 - 四柱排盘、天干地支关系
  • 五行力量 - 精确计算五行得分
  • 🔮 十神配置 - 自动计算十神关系
  • ⚖️ 身强身弱 - 准确判断日主强弱
  • 🌟 喜用神推算 - 智能分析喜用神和忌神
  • 📅 运程推算 - 大运、流年、流月、流日、小运
  • 🔄 十二长生 - 分析日主在各地支的状态
  • 🏮 神煞分析 - 50+ 种传统神煞
  • 📚 TypeScript - 完整类型定义

📦 安装

npm install bazi.js

🚀 快速开始

import { Bazi } from 'bazi.js';

const bazi = new Bazi({
  year: 1994,
  month: 2,
  day: 2,
  hour: 11,
  minute: 10,
  gender: 'male',
});

// 基本信息
console.log('八字:', bazi.toString());
console.log('日主:', bazi.getDayMaster());

// 五行力量
console.log('五行:', bazi.getWuXingStrength());

// 身强身弱
const strength = bazi.getStrengthAnalysis();
console.log('判定:', strength.isStrong ? '身强' : '身弱');

// 喜用神
const yongShen = bazi.getYongShenAnalysis();
console.log('喜用神:', yongShen.xiYongShen);

// 神煞
const shenSha = bazi.getShenShaAnalysis();
console.log('吉神:', shenSha.auspicious.map(s => s.name));

// 大运
const daYunList = bazi.getDaYunList();
daYunList.forEach(dy => {
  console.log(`${dy.startAge}-${dy.endAge}岁: ${dy.gan}${dy.zhi}`);
});

日本語

四柱推命分析のための包括的なTypeScript/JavaScriptライブラリ。

✨ 特徴

  • 🎯 完全な八字分析 - 四柱推命、天干地支
  • 五行の力量 - 精密な計算
  • 🔮 十神配置 - 自動計算
  • ⚖️ 身強身弱 - 正確な判定
  • 🌟 喜用神 - スマート分析
  • 📅 運勢 - 大運、流年、流月、流日
  • 🏮 神殺 - 50種類以上
  • 📚 TypeScript - 完全な型定義

📦 インストール

npm install bazi.js

🚀 クイックスタート

import { Bazi } from 'bazi.js';

const bazi = new Bazi({
  year: 1994, month: 2, day: 2,
  hour: 11, minute: 10, gender: 'male',
});

console.log('八字:', bazi.toString());
console.log('日主:', bazi.getDayMaster());
console.log('五行:', bazi.getWuXingStrength());
console.log('神殺:', bazi.getShenShaAnalysis().auspicious.map(s => s.name));

한국어

사주팔자 분석을 위한 포괄적인 TypeScript/JavaScript 라이브러리.

✨ 특징

  • 🎯 완전한 사주 분석 - 사주, 천간지지
  • 오행 역량 - 정밀 계산
  • 🔮 십신 배치 - 자동 계산
  • ⚖️ 신강신약 - 정확한 판정
  • 🌟 희용신 - 스마트 분석
  • 📅 운세 - 대운, 세운, 월운, 일운
  • 🏮 신살 - 50가지 이상
  • 📚 TypeScript - 완전한 타입 정의

📦 설치

npm install bazi.js

🚀 빠른 시작

import { Bazi } from 'bazi.js';

const bazi = new Bazi({
  year: 1994, month: 2, day: 2,
  hour: 11, minute: 10, gender: 'male',
});

console.log('사주:', bazi.toString());
console.log('일주:', bazi.getDayMaster());
console.log('오행:', bazi.getWuXingStrength());
console.log('신살:', bazi.getShenShaAnalysis().auspicious.map(s => s.name));

📖 API Reference

| Method | Description | |--------|-------------| | getSiZhu() | Four Pillars / 四柱 | | getDayMaster() | Day Master / 日主 | | getWuXingStrength() | Five Elements / 五行 | | getStrengthAnalysis() | Strong/Weak / 身强身弱 | | getYongShenAnalysis() | Favorable Elements / 喜用神 | | getTianGanRelations() | Heavenly Stems / 天干关系 | | getDiZhiRelations() | Earthly Branches / 地支关系 | | getShiShenConfig() | Ten Gods / 十神 | | getChangShengAnalysis() | Twelve Stages / 十二长生 | | getShenShaAnalysis() | Shen Sha / 神煞 | | getDaYunList() | Major Luck / 大运 | | getLiuNianList() | Annual Luck / 流年 | | getLiuYueList() | Monthly Luck / 流月 | | getLiuRiList() | Daily Luck / 流日 | | getXiaoYun() | Minor Luck / 小运 | | getFullAnalysis() | Complete Analysis / 完整分析 |

🏮 Shen Sha Categories / 神煞分类

| Category | Examples | |----------|----------| | 贵人类 | 天乙贵人, 太极贵人, 天德贵人, 月德贵人, 文昌贵人 | | 驿马桃花类 | 驿马, 桃花, 红鸾, 天喜 | | 禄神类 | 禄神, 羊刃, 金舆, 天厨, 福星 | | 学堂词馆类 | 学堂, 词馆, 华盖, 将星, 天医 | | 凶神类 | 空亡, 亡神, 劫煞, 灾煞, 孤辰, 寡宿 | | 特殊日柱类 | 魁罡, 日德, 十恶大败, 阴阳差错 |

📦 Dependencies

📄 License

ISC

👤 Author

Perry