Employee Spotlight
From Academia to Industry
Philipp Burckhardt recounts his journey from childhood computer fascinations, to building an e-learning platform at Carnegie Mellon University, and on to his current role at Socket.
iztro
Advanced tools
轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。A lightweight kit to astrolabe generator of The Purple Star Astrology (Zi Wei Dou Shu). The Purple Star Astrology(Zi Wei Dou Shu) is a Chinese ancient astrology. You're able to get your horoscope and personality
Changelog
v2.4.3
🛠️ 修复(fix)
🇨🇳
🇺🇸
Readme
一套轻量级紫微斗数排盘工具库。
用于紫微斗数排盘的javascript开源库,有以下功能。
输入
可以实现下列功能
其他
多语言输入/输出
输入的时候支持多个国家和地区语言混合输入,可以输出指定语言。目前支持 简体中文,繁体中文,英文,日文,韩文,越南语。英文的翻译目前还没有标准,所以我大多是意译的,但也正因为如此,可能英文版本的会更加易懂。如果有精通星象翻译的欢迎提 PR 。任何语言都可以。
链式调用
假如你想判断 紫微星 的 三方四正 有没有 化忌,你可以这样做
import { astro } from 'iztro';
const astrolabe = astro.bySolar('2000-8-16', 2, '男', true, 'zh-CN');
astrolabe.star('紫微').surroundedPalaces().haveMutagen('忌');
配置和插件
紫微斗数流派众多,不同的流派的四化以及星耀亮度都会有些许差异,为了满足不同流派的需求和功能的扩展,iztro在 v2.3.0 版本加入了全局配置和第三方插件功能。详见配置文档
[!IMPORTANT] 如果你在开发中遇到任何问题,可以添加作者微信咨询
你也可以任意魔改代码,或联系作者获取技术支持
你可以使用任何你熟悉的包管理库来安装iztro
NPM
npm install iztro -S
Yarn
yarn add iztro
pnpm
pnpm install iztro -S
假如你使用的是静态 html
文件,可以下载 release 资源文件中的 iztro-min-js.tar.gz
压缩包,里面包含了一个 iztro
压缩混淆过的js
文件和对应的sourcemap
文件。
v2.0.4+
版本才提供独立js库。
将 iztro.min.js
用script标签引入html文件使用。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>iztro-紫微斗数开源库</title>
</head>
<body>
<script src="./iztro.min.js"></script>
<script>
// 获取一张星盘数据
var astrolabe = iztro.astro.bySolar('2000-8-16', 2, '男', true, 'zh-CN');
</script>
</body>
</html>
当然,我们更推荐你直接使用 CDN
加速链接,你可以在下面列表中选择一个,在没有指定版本号的时候,会自动指向最新版本的代码库
jsdelivr
unpkg
你也可以使用如下规则来指定版本:
iztro@2
iztro@^2.0.5
iztro@2.0.5
应为纯JS库没有代码提示和注释,所以在集成的时候请参阅 iztro开发文档
这里是一个简单的例子显示如何调用iztro
获取到紫微斗数星盘数据,详细文档请移步开发文档
ES6 Module
import { astro } from 'iztro';
// 通过阳历获取星盘信息
const astrolabe = astro.bySolar('2000-8-16', 2, '女', true, 'zh-CN');
// 通过农历获取星盘信息
const astrolabe = astro.byLunar('2000-7-17', 2, '女', false, true, 'zh-CN');
CommonJS
var iztro = require('iztro');
// 通过阳历获取星盘信息
var astrolabe = iztro.astro.bySolar('2000-8-16', 2, '女', true, 'zh-CN');
// 通过农历获取星盘信息
var astrolabe = iztro.astro.byLunar('2000-7-17', 2, '女', false, true, 'zh-CN');
如果你对iztro
有兴趣,也想加入贡献队伍,我们非常欢迎,你可以用以下方式进行:
功能需求
。BUG报告
。fork
到你自己的仓库进行编辑,然后提交PR到本仓库。fork
本仓库,然后在locales文件夹下创建一个国际化语言文件,然后复制其他语言文件目录里面的文件到你的目录下进行更改。[!IMPORTANT] 如果你觉得代码对你有用,请点⭐支持,你的⭐是我持续更新的动力
使用本程序返回的数据,你可以生成这样一张星盘,当然这只是一个例子,你可以把注意力集中在星盘的设计上,也可以把重心放在数据的分析上,本程序为你解决了最繁冗的工作,让你可以把精力更多的放在你所需要关注的事情上面。
MIT License
Copyright © 2023 All Contributors
[!NOTE] 请合理使用本开源代码,禁止用于非法目的。
FAQs
轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。A lightweight kit to astrolabe generator of The Purple Star Astrology (Zi Wei Dou Shu). The Purple Star Astrology(Zi Wei Dou Shu) is a Chinese ancient astrology. You're able to get your horoscope and personality
We found that iztro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Employee Spotlight
Philipp Burckhardt recounts his journey from childhood computer fascinations, to building an e-learning platform at Carnegie Mellon University, and on to his current role at Socket.
Security News
Git dependencies in open source packages can introduce significant risks, including lack of version control, stability issues, dependency drift, and difficulty in auditing, making them potential targets for supply chain attacks.
Security News
Node.js has added experimental support for TypeScript, a move that highlights the growing importance of TypeScript in modern development.