📢 介绍(Introduction)
🇨🇳
用于紫微斗数排盘的工具库,文档还在整理中,大家有任何问题欢迎到这里提问交流,也可以直接向我发送邮件(sylarlong@gmail.com,alsogood@qq.com)。扣码不易,希望得到各位大佬的星星。之后会陆续添加更多实用功能和国际化,敬请期待。🍻
🇺🇸
This framework is used to generate the astrolabe of The Purple Star Astrology(Zi Wei Dou Shu). The document is under progressing. If you have any issue please feel free to create issues in here or just send an email (sylarlong@gmail.com or alsogood@qq.com) to me directly. I'll appreciate your star. More useful functions and localization are coming soon. stay tuned!🍻
🌰 举个栗子(Demo)
Demo 地址:https://a.14star.cn
🎲 用法(How to use it?)
🚀 让我们开始把(Let's get started)
npm i @sylarlong/astro -S
❓ 调用方法(Usage)
-
ES6 Module
import { astro } from '@sylarlong/astro';
const astrolable = astro.astrolableBySolarDate('2000-8-16', 2, '女');
const astrolable = astro.astrolableByLunarDate('2000-7-17', 2, '女', false, true);
-
CommonJS
var astroObj = require("@sylarlong/astro")
var astrolable = astroObj.astro.astrolableBySolarDate('2000-8-16', 2, '女');
var astrolable = astroObj.astro.astrolableByLunarDate('2000-7-17', 2, '女', false, true);
✍️ 方法定义(function definition)
-
astrolableBySolarDate
type astrolableBySolarDate = (
solarDateStr: string,
timeIndex: number,
gender: Gender,
fixLeap: boolean = true,
) => Astrolabe;
-
astrolableByLunarDate
type astrolableByLunarDate = (
lunarDateStr: string,
timeIndex: number,
gender: Gender,
isLeapMonth: boolean = false,
fixLeap: boolean = true,
) => Astrolabe;
📑 返回数据 (Response data)
{
solarDate: '2000-8-16',
lunarDate: '二〇〇〇年七月十七',
chineseDate: '庚辰 甲申 丙午 庚寅',
time: '寅时',
timeRange: '03:00~05:00',
sign: '狮子座',
zodiac: '龙',
earthlyBranchOfSoulPalace: '午',
earthlyBranchOfBodyPalace: '戌',
soul: '破军',
body: '文昌',
fiveElementsClass: '木三局',
palaces: [
{
name: '财帛',
isBodyPalace: false,
isOriginalPalace: false,
heavenlyStem: '戊',
earthlyBranch: '寅',
majorStars: [
{ name: '武曲', type: 'major', scope: 'origin', brightness: '得' },
{ name: '天相', type: 'major', scope: 'origin', brightness: '庙' },
{ name: '天马', type: 'tianma', scope: 'origin', brightness: '' },
],
minorStars: [],
adjectiveStars: [
{ name: '月解', type: 'helper', scope: 'origin' },
{ name: '三台', type: 'adjective', scope: 'origin' },
{ name: '天寿', type: 'adjective', scope: 'origin' },
{ name: '天巫', type: 'adjective', scope: 'origin' },
{ name: '天厨', type: 'adjective', scope: 'origin' },
{ name: '阴煞', type: 'adjective', scope: 'origin' },
{ name: '天哭', type: 'adjective', scope: 'origin' },
],
changsheng12: '绝',
boshi12: '蜚廉',
jiangqian12: '岁驿',
suiqian12: '吊客',
decadal: { range: [44, 53], heavenlyStem: '戊' },
ages: [9, 21, 33, 45, 57, 69, 81],
},
],
}
✍️ 返回数据定义(Response data definition)
export type Star = {
name: string;
type: StarType;
scope: Scope;
brightness?: StarBrightness;
mutagen?: Mutagen;
};
export type Decadal = {
range: number[];
heavenlyStem: HeavenlyStem;
earthlyBranch: EarthlyBranch;
};
export type Palace = {
name: PalaceName;
isBodyPalace: boolean;
isOriginalPalace: boolean;
heavenlyStem: HeavenlyStem;
earthlyBranch: EarthlyBranch;
majorStars: Star[];
minorStars: Star[];
adjectiveStars: Star[];
changsheng12: string;
boshi12: string;
jiangqian12: string;
suiqian12: string;
decadal: Decadal;
ages: number[];
};
export type Astrolabe = {
solarDate: string;
lunarDate: string;
chineseDate: string;
time: BirthTime;
timeRange: TimeRange;
sign: string;
zodiac: string;
earthlyBranchOfSoulPalace: EarthlyBranch;
earthlyBranchOfBodyPalace: EarthlyBranch;
soul: string;
body: string;
fiveElementsClass: FiveElementsClassItem;
palaces: Palace[];
};
✨ 获取流耀(Get horoscope stars)
❓ 调用方法(Usage)
-
ES6 Module
import { star } from '@sylarlong/astro';
const horoscopeStars = star.getHoroscopeStar('庚', '辰', 'decadal');
-
CommonJS
var astroObj = require("@sylarlong/astro")
var horoscopeStars = astroObj.star.getHoroscopeStar('庚', '辰', 'decadal');
✍️ 方法定义(function definition)
-
getHoroscopeStar
type getHoroscopeStar = (
heavenlyStem: HeavenlyStem,
earthlyBranch: EarthlyBranch,
scope: 'decadal' | 'yearly',
) => Star[][];
📑 返回数据 (Response data)
[
[{ name: '运马', type: 'tianma', scope: 'decadal' }],
[{ name: '运曲', type: 'soft', scope: 'decadal' }],
[],
[{ name: '运喜', type: 'flower', scope: 'decadal' }],
[],
[
{ name: '运钺', type: 'soft', scope: 'decadal' },
{ name: '运陀', type: 'tough', scope: 'decadal' },
],
[{ name: '运禄', type: 'lucun', scope: 'decadal' }],
[{ name: '运羊', type: 'tough', scope: 'decadal' }],
[],
[
{ name: '运昌', type: 'soft', scope: 'decadal' },
{ name: '运鸾', type: 'flower', scope: 'decadal' },
],
[],
[{ name: '运魁', type: 'soft', scope: 'decadal' }],
];
☕ 总结(Summary)
🇨🇳
以上数据可以生成如下星盘,其中palaces
数据用于填充12宫,其他数据用于填充中宫。
🇺🇸
You can create the astrolabe below based on the response data above. palaces
is used to fill the 12-Palace and other fields are used to fill the Center Palace.
📜 版权(LICENSE)
MIT License
Copyright © 2023 Sylar Long