GithubHelp home page GithubHelp logo

laok724 / iztro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sylarlong/iztro

0.0 0.0 0.0 16.01 MB

⭐A lightweight open-source JavaScript library for obtaining The Purple Star Astrology (Zi Wei Dou Shu) astrolabe information.. 支持多语言轻量级获取紫微斗数排盘信息的javascript开源库。

Home Page: https://iztro.com

License: MIT License

JavaScript 0.60% TypeScript 99.40%

iztro's Introduction

banner2

一套轻量级紫微斗数排盘工具库。

Maintainability Codecov npm Codecov npm GitHub GitHub code size in bytes npm bundle size FOSSA Status Package Quality


简体中文 🔸 繁體中文 🔸 English


介绍

用于紫微斗数排盘的javascript开源库,有以下功能。

  • 输入

    • 生日(阳历或农历皆可)
    • 出生时间
    • 性别
  • 可以实现下列功能

    • 紫微斗数 12 宫的星盘数据
    • 获取生肖
    • 获取星座
    • 获取四柱(干支纪年法的生辰)
    • 获取运限(大限,小限,流年,流月,流日,流时)的数据
    • 获取流耀(大限和流年的动态星耀)
    • 判断指定宫位是否存在某些星耀
    • 判断指定宫位三方四正是否存在某些星耀
    • 判断指定宫位三方四正是否存在四化
    • 判断指定星耀是否存在四化
    • 判断指定星耀三方四正是否存在四化
    • 判断指定星耀是否是某个亮度
    • 根据天干获取四化
    • 获取指定星耀所在宫位
    • 获取指定宫位三方四正宫位
    • 获取指定星耀三方四正宫位
    • 获取指定星耀对宫
    • 获取指定运限宫位
    • 获取指定运限宫位的三方四正
    • 判断指定运限宫位内是否存在某些星耀
    • 判断指定运限宫位内是否存在四化
    • 判断指定运限三方四正内是否存在某些星耀
    • 判断指定运限三方四正内是否存在四化
    • 判断指定宫位是否是空宫
    • 判断宫位是否产生飞星到目标宫位
    • 获取宫位产生的四化宫位
  • 其他

    • 多语言输入/输出

      输入的时候支持多个国家和地区语言混合输入,可以输出指定语言。目前支持 简体中文,繁体中文,英文,日文,韩文,越南语。英文的翻译目前还没有标准,所以我大多是意译的,但也正因为如此,可能英文版本的会更加易懂。如果有精通星象翻译的欢迎提 PR 。任何语言都可以。

    • 链式调用

      假如你想判断 紫微星 的 三方四正 有没有 化忌,你可以这样做

      import { astro } from 'iztro';
      
      const astrolabe = astro.bySolar('2000-8-16', 2, '男', true, 'zh-CN');
      
      astrolabe.star('紫微').surroundedPalaces().haveMutagen('忌');

Important

如果你在开发中遇到任何问题,可以添加作者微信咨询
你也可以任意魔改代码,或联系作者获取技术支持
WeChat

快捷跳转

安装依赖

你可以使用任何你熟悉的包管理库来安装iztro

  • NPM

    npm install iztro -S
    
  • Yarn

    yarn add iztro
    
  • pnpm

    pnpm install iztro -S
    

独立js库

假如你使用的是静态 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 加速链接,你可以在下面列表中选择一个,在没有指定版本号的时候,会自动指向最新版本的代码库

你也可以使用如下规则来指定版本:

应为纯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,请到这里创建一个BUG报告
  • 你也可以将本仓库fork到你自己的仓库进行编辑,然后提交PR到本仓库。
  • 假如你擅长外语,我们也欢迎你对国际化文件的翻译做出你的贡献,你可以fork本仓库,然后在locales文件夹下创建一个国际化语言文件,然后复制其他语言文件目录里面的文件到你的目录下进行更改。
  • 当然,如果你觉得本程序对你有用,请给我买杯咖啡☕️ Static Badge

Important

如果你觉得代码对你有用,请点⭐支持,你的⭐是我持续更新的动力

总结

使用本程序返回的数据,你可以生成这样一张星盘,当然这只是一个例子,你可以把注意力集中在星盘的设计上,也可以把重心放在数据的分析上,本程序为你解决了最繁冗的工作,让你可以把精力更多的放在你所需要关注的事情上面。

image

Star趋势

Star History Chart

MIT License

Copyright © 2023 All Contributors

Note

请合理使用本开源代码,禁止用于非法目的。

FOSSA Status

iztro's People

Contributors

dependabot[bot] avatar fossabot avatar sanchun333 avatar sylarlong avatar thiepwong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.