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 🙏

© 2024 – Pkg Stats / Ryan Hefner

iztro

v2.4.3

Published

轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。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

Downloads

454

Readme

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('忌');
    • 配置和插件

      紫微斗数流派众多,不同的流派的四化以及星耀亮度都会有些许差异,为了满足不同流派的需求和功能的扩展,iztro在 v2.3.0 版本加入了全局配置和第三方插件功能。详见配置文档

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

快捷跳转

安装依赖

你可以使用任何你熟悉的包管理库来安装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 加速链接,你可以在下面列表中选择一个,在没有指定版本号的时候,会自动指向最新版本的代码库

  • jsdelivr

    • https://cdn.jsdelivr.net/npm/iztro/dist/iztro.min.js
    • https://cdn.jsdelivr.net/npm/[email protected]/dist/iztro.min.js
  • unpkg

    • https://unpkg.com/iztro/dist/iztro.min.js
    • https://unpkg.com/[email protected]/dist/iztro.min.js

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

应为纯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] 如果你觉得代码对你有用,请点⭐支持,你的⭐是我持续更新的动力

总结

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

Star趋势

版权

MIT License

Copyright © 2023 All Contributors

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

FOSSA Status