liuyao 0.1.0 → 0.1.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/README.md CHANGED
@@ -6,11 +6,11 @@ For more packages, see [my homepage](https://baendlorel.github.io/?repoType=npm)
6
6
 
7
7
  ## Features
8
8
 
9
- - Create a yao from its yang-count representation.
10
- - Build a hexagram from six yao lines or from a known hexagram name.
9
+ - Create a yao from its Yang-count representation, quaternary or various arguments.
10
+ - Build a hexagram from six Yao lines or from a known hexagram name.
11
11
  - Inspect hexagram metadata such as its name, palace, phase, and setup information.
12
12
  - Derive the changed hexagram for dynamic lines.
13
- - Access six-god ordering data for different heavenly stems.
13
+ - Access Six God ordering data for different heavenly stems.
14
14
 
15
15
  ## Installation
16
16
 
@@ -23,16 +23,9 @@ pnpm add liuyao
23
23
  ```ts
24
24
  import { Hexagram, Yao, SixGodList } from 'liuyao';
25
25
 
26
- const hexagram = Hexagram.fromYaos([
27
- new Yao(3),
28
- new Yao(1),
29
- new Yao(2),
30
- new Yao(2),
31
- new Yao(1),
32
- new Yao(0),
33
- ]);
26
+ const hexagram = Hexagram.fromQuaternary('111222'); // gets a Hexagram instance of '地天泰'
34
27
 
35
- if (!hexagram) {
28
+ if (hexagram === null) {
36
29
  throw new Error('Invalid hexagram');
37
30
  }
38
31
 
@@ -101,11 +94,19 @@ Useful factory methods:
101
94
 
102
95
  The package currently exports:
103
96
 
97
+ **Classes:**
104
98
  - `Hexagram`
105
99
  - `Yao`
106
- - `YaoIndex`
107
- - `SixGodList`
100
+
101
+ **Data Lists:**
102
+ - `HexagramList`(六十四卦): Includes 64 static hexagram info objects with traditional metadata.
103
+ - `HexagramYaoIndex`(六十四卦爻位名)
104
+ - `TrigramList`(八卦): Includes 8 static trigram info objects with traditional metadata.
105
+ - `SixGodList`(六神表)
106
+
107
+ **Types:**
108
108
  - type `SixGod`
109
+ - type `SixGodInfo`
109
110
  - type `SetupGramInfo`
110
111
 
111
112
  ## Notes
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ interface PalaceIndexName {
30
30
  name: string;
31
31
  nameEn: string;
32
32
  }
33
- declare const PalaceIndexList: PalaceIndexName[];
33
+ declare const PalaceIndexTable: PalaceIndexName[];
34
34
  interface HexagramInfo {
35
35
  /**
36
36
  * Binary representation of the hexagram, where 0 represents a yin line and 1 represents a yang line. The lines are ordered from the bottom (first line) to the top (sixth line).
@@ -82,7 +82,7 @@ interface HexagramInfo {
82
82
  */
83
83
  setupInfo: [SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo];
84
84
  }
85
- declare const HexagramList: readonly HexagramInfo[];
85
+ declare const HexagramInfoTable: readonly HexagramInfo[];
86
86
  interface TrigramInfo {
87
87
  /**
88
88
  * Presents the trigram as a 3-digit binary string. 1 represents a Yang line and 0 represents a Yin line.
@@ -118,7 +118,7 @@ interface TrigramInfo {
118
118
  /**
119
119
  * List of all trigrams in the I Ching, with their binary representation, number of yang lines, name, what they represent, and their corresponding sign.
120
120
  */
121
- declare const TrigramList: readonly TrigramInfo[];
121
+ declare const TrigramInfoTable: readonly TrigramInfo[];
122
122
 
123
123
  type SixGod = '玄武' | '白虎' | '螣蛇' | '勾陈' | '朱雀' | '青龙';
124
124
  interface SixGodInfo {
@@ -145,7 +145,7 @@ interface SixGodInfo {
145
145
  /**
146
146
  * @see 《增删卜易·六神章》
147
147
  */
148
- declare const SixGodList: readonly SixGodInfo[];
148
+ declare const SixGodTable: readonly SixGodInfo[];
149
149
 
150
150
  declare class Yao {
151
151
  static getName(yangCount: number): "老阴" | "少阳" | "少阴" | "老阳";
@@ -226,7 +226,7 @@ declare class Yao {
226
226
  }
227
227
 
228
228
  type LiuYao = [Yao, Yao, Yao, Yao, Yao, Yao];
229
- declare const YaoIndex: readonly ["初爻", "二爻", "三爻", "四爻", "五爻", "上爻"];
229
+ declare const HexagramYaoIndex: readonly ["初爻", "二爻", "三爻", "四爻", "五爻", "上爻"];
230
230
  /**
231
231
  * Hexagram class represents a hexagram, which consists of 6 Yao.
232
232
  * - Each Yao can be either yin or yang, and can be changing or not.
@@ -237,7 +237,7 @@ declare class Hexagram {
237
237
  /**
238
238
  * Use tokens like `'012132'` to create a Hexagram, where each digit represents the count of Yang in the corresponding Yao (0 for 老阴, 1 for 少阳, 2 for 少阴, 3 for 老阳). The first digit represents the first Yao (初爻) and the last digit represents the sixth Yao (上爻).
239
239
  */
240
- static fromBinary(quaternary: string): Hexagram | null;
240
+ static fromQuaternary(quaternary: string): Hexagram | null;
241
241
  /**
242
242
  * Use tokens like `'单单拆拆重重'` to create a Hexagram.
243
243
  *
@@ -298,5 +298,5 @@ declare class Hexagram {
298
298
  [Symbol.toPrimitive](hint: string): string;
299
299
  }
300
300
 
301
- export { Hexagram, HexagramList, PalaceIndexList, SixGodList, TrigramList, Yao, YaoIndex };
301
+ export { Hexagram, HexagramInfoTable, HexagramYaoIndex, PalaceIndexTable, SixGodTable, TrigramInfoTable, Yao };
302
302
  export type { HexagramInfo, SetupGramInfo, SixGod, SixGodInfo, TrigramInfo };
package/dist/index.mjs CHANGED
@@ -1655,7 +1655,7 @@ class h {
1655
1655
  const r = [ "初爻", "二爻", "三爻", "四爻", "五爻", "上爻" ];
1656
1656
 
1657
1657
  class l {
1658
- static fromBinary(n) {
1658
+ static fromQuaternary(n) {
1659
1659
  const i = n.split("").map(h.fromDigitString);
1660
1660
  return i.every(n => null !== n) ? new l(i) : null;
1661
1661
  }
@@ -1728,4 +1728,4 @@ class l {
1728
1728
  }
1729
1729
  }
1730
1730
 
1731
- export { l as Hexagram, i as HexagramList, n as PalaceIndexList, s as SixGodList, e as TrigramList, h as Yao, r as YaoIndex };
1731
+ export { l as Hexagram, i as HexagramInfoTable, r as HexagramYaoIndex, n as PalaceIndexTable, s as SixGodTable, e as TrigramInfoTable, h as Yao };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liuyao",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "author": {
5
5
  "name": "Kasukabe Tsumugi",
6
6
  "email": "futami16237@gmail.com"
@@ -38,4 +38,4 @@
38
38
  "url": "https://github.com/baendlorel/kt-packages/issues"
39
39
  },
40
40
  "homepage": "https://github.com/baendlorel/kt-packages/tree/main/packages/liuyao#readme"
41
- }
41
+ }