liuyao 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -301,8 +301,8 @@ declare class Hexagram {
301
301
  * This output is meant for AI skills.
302
302
  */
303
303
  toAIReadable(): {
304
- 本卦: HexagramAIReadable<'本卦'>;
305
- 变卦: HexagramAIReadable<'变卦'> | null;
304
+ 本卦: HexagramAIReadable;
305
+ 变卦: HexagramAIReadable | '无';
306
306
  世应变化: string;
307
307
  };
308
308
  clone(): Hexagram;
@@ -311,10 +311,10 @@ declare class Hexagram {
311
311
  }
312
312
  interface YaoInfo {
313
313
  爻: string;
314
- 类型: '世' | '应' | null;
315
- 六亲地支五行: string;
314
+ 类型?: '世' | '应';
315
+ 六亲: string;
316
316
  }
317
- interface HexagramAIReadable<T extends '本卦' | '变卦'> {
317
+ interface HexagramAIReadable {
318
318
  初爻: YaoInfo;
319
319
  二爻: YaoInfo;
320
320
  三爻: YaoInfo;
package/dist/index.mjs CHANGED
@@ -1731,76 +1731,36 @@ class l {
1731
1731
  n.includes(t) && ("世" === e.hostGuest && s.push(`新世爻为${i.info.id}的${r[t]}`), "应" === e.hostGuest && s.push(`新应爻为${i.info.id}的${r[t]}`));
1732
1732
  });
1733
1733
  } else s.push("没有新的世应爻出现,世应不变");
1734
+ const t = (n, i, e) => {
1735
+ const s = {
1736
+ "爻": this.yaos[e].name,
1737
+ "六亲": i[e].kin,
1738
+ "类型": i[e].hostGuest
1739
+ };
1740
+ return s.类型 || delete s.类型, s;
1741
+ };
1734
1742
  return {
1735
1743
  "本卦": {
1736
- "上爻": {
1737
- "爻": this.yaos[5].name,
1738
- "类型": n[5].hostGuest || null,
1739
- "六亲地支五行": n[5].kin
1740
- },
1741
- "五爻": {
1742
- "爻": this.yaos[4].name,
1743
- "类型": n[4].hostGuest || null,
1744
- "六亲地支五行": n[4].kin
1745
- },
1746
- "四爻": {
1747
- "爻": this.yaos[3].name,
1748
- "类型": n[3].hostGuest || null,
1749
- "六亲地支五行": n[3].kin
1750
- },
1751
- "三爻": {
1752
- "爻": this.yaos[2].name,
1753
- "类型": n[2].hostGuest || null,
1754
- "六亲地支五行": n[2].kin
1755
- },
1756
- "二爻": {
1757
- "爻": this.yaos[1].name,
1758
- "类型": n[1].hostGuest || null,
1759
- "六亲地支五行": n[1].kin
1760
- },
1761
- "初爻": {
1762
- "爻": this.yaos[0].name,
1763
- "类型": n[0].hostGuest || null,
1764
- "六亲地支五行": n[0].kin
1765
- },
1744
+ "上爻": t(this.yaos, n, 5),
1745
+ "五爻": t(this.yaos, n, 4),
1746
+ "四爻": t(this.yaos, n, 3),
1747
+ "三爻": t(this.yaos, n, 2),
1748
+ "二爻": t(this.yaos, n, 1),
1749
+ "初爻": t(this.yaos, n, 0),
1766
1750
  "卦名": this.info.id,
1767
1751
  "宫": this.palace,
1768
1752
  "变爻": this.isDynamic ? this.yaos.map((n, i) => n.isDynamic ? r[i] : null).filter(n => null !== n) : void 0
1769
1753
  },
1770
1754
  "变卦": e ? {
1771
- "上爻": {
1772
- "爻": i.yaos[5].name,
1773
- "类型": e[5].hostGuest || null,
1774
- "六亲地支五行": e[5].kin
1775
- },
1776
- "五爻": {
1777
- "爻": i.yaos[4].name,
1778
- "类型": e[4].hostGuest || null,
1779
- "六亲地支五行": e[4].kin
1780
- },
1781
- "四爻": {
1782
- "爻": i.yaos[3].name,
1783
- "类型": e[3].hostGuest || null,
1784
- "六亲地支五行": e[3].kin
1785
- },
1786
- "三爻": {
1787
- "爻": i.yaos[2].name,
1788
- "类型": e[2].hostGuest || null,
1789
- "六亲地支五行": e[2].kin
1790
- },
1791
- "二爻": {
1792
- "爻": i.yaos[1].name,
1793
- "类型": e[1].hostGuest || null,
1794
- "六亲地支五行": e[1].kin
1795
- },
1796
- "初爻": {
1797
- "爻": i.yaos[0].name,
1798
- "类型": e[0].hostGuest || null,
1799
- "六亲地支五行": e[0].kin
1800
- },
1755
+ "上爻": t(i.yaos, e, 5),
1756
+ "五爻": t(i.yaos, e, 4),
1757
+ "四爻": t(i.yaos, e, 3),
1758
+ "三爻": t(i.yaos, e, 2),
1759
+ "二爻": t(i.yaos, e, 1),
1760
+ "初爻": t(i.yaos, e, 0),
1801
1761
  "卦名": i.info.id,
1802
1762
  "宫": i.palace
1803
- } : null,
1763
+ } : "无",
1804
1764
  "世应变化": s.join(",")
1805
1765
  };
1806
1766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liuyao",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "author": {
5
5
  "name": "Kasukabe Tsumugi",
6
6
  "email": "futami16237@gmail.com"
@@ -45,4 +45,4 @@
45
45
  "dependencies": {
46
46
  "solarlunar": "^3.1.0"
47
47
  }
48
- }
48
+ }