@gracefullight/saju 1.1.3 → 1.3.0
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.ko.md +25 -13
- package/README.md +25 -13
- package/dist/__tests__/relations.test.js +1 -0
- package/dist/__tests__/ten-gods.test.js +33 -1
- package/dist/__tests__/yongshen.test.js +9 -5
- package/dist/core/four-pillars.d.ts.map +1 -1
- package/dist/core/four-pillars.js +47 -4
- package/dist/core/luck.d.ts +6 -0
- package/dist/core/luck.d.ts.map +1 -1
- package/dist/core/luck.js +24 -2
- package/dist/core/nayin.d.ts +16 -0
- package/dist/core/nayin.d.ts.map +1 -0
- package/dist/core/nayin.js +83 -0
- package/dist/core/relations.d.ts +21 -3
- package/dist/core/relations.d.ts.map +1 -1
- package/dist/core/relations.js +74 -10
- package/dist/core/sinsals.d.ts +1 -1
- package/dist/core/sinsals.d.ts.map +1 -1
- package/dist/core/sinsals.js +100 -0
- package/dist/core/solar-terms.d.ts.map +1 -1
- package/dist/core/solar-terms.js +28 -1
- package/dist/core/strength.d.ts.map +1 -1
- package/dist/core/strength.js +24 -1
- package/dist/core/ten-gods.d.ts +1 -0
- package/dist/core/ten-gods.d.ts.map +1 -1
- package/dist/core/ten-gods.js +3 -0
- package/dist/core/yongshen.d.ts.map +1 -1
- package/dist/core/yongshen.js +35 -12
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/utils/constants.js +1 -1
- package/package.json +12 -12
package/README.ko.md
CHANGED
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
## 설치
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
#
|
|
42
|
-
|
|
41
|
+
# bun 사용
|
|
42
|
+
bun add @gracefullight/saju
|
|
43
43
|
|
|
44
44
|
# npm 사용
|
|
45
45
|
npm install @gracefullight/saju
|
|
@@ -54,10 +54,10 @@ yarn add @gracefullight/saju
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
# 옵션 1: Luxon (현대적인 앱에 권장)
|
|
57
|
-
|
|
57
|
+
bun add luxon @types/luxon
|
|
58
58
|
|
|
59
59
|
# 옵션 2: date-fns (가벼운 대안)
|
|
60
|
-
|
|
60
|
+
bun add date-fns date-fns-tz
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
## 빠른 시작
|
|
@@ -803,22 +803,22 @@ git clone https://github.com/gracefullight/saju.git
|
|
|
803
803
|
cd saju
|
|
804
804
|
|
|
805
805
|
# 의존성 설치
|
|
806
|
-
|
|
806
|
+
bun install
|
|
807
807
|
|
|
808
808
|
# 테스트 실행
|
|
809
|
-
|
|
809
|
+
bun test
|
|
810
810
|
|
|
811
811
|
# 커버리지 확인
|
|
812
|
-
|
|
812
|
+
bun test:coverage
|
|
813
813
|
|
|
814
814
|
# 빌드
|
|
815
|
-
|
|
815
|
+
bun build
|
|
816
816
|
|
|
817
817
|
# 린트
|
|
818
|
-
|
|
818
|
+
bun lint
|
|
819
819
|
|
|
820
820
|
# 포맷
|
|
821
|
-
|
|
821
|
+
bun lint:fix
|
|
822
822
|
```
|
|
823
823
|
|
|
824
824
|
### 프로젝트 구조
|
|
@@ -851,13 +851,13 @@ packages/saju/
|
|
|
851
851
|
|
|
852
852
|
```bash
|
|
853
853
|
# 모든 테스트 실행
|
|
854
|
-
|
|
854
|
+
bun test
|
|
855
855
|
|
|
856
856
|
# watch 모드로 테스트 실행
|
|
857
|
-
|
|
857
|
+
bun test:watch
|
|
858
858
|
|
|
859
859
|
# 커버리지 리포트 생성
|
|
860
|
-
|
|
860
|
+
bun test:coverage
|
|
861
861
|
```
|
|
862
862
|
|
|
863
863
|
커버리지 결과:
|
|
@@ -951,6 +951,18 @@ MIT © [gracefullight](https://github.com/gracefullight)
|
|
|
951
951
|
- [Luxon](https://moment.github.io/luxon/) - 현대적인 날짜/시간 라이브러리
|
|
952
952
|
- [date-fns](https://date-fns.org/) - 현대적인 JavaScript 날짜 유틸리티 라이브러리
|
|
953
953
|
|
|
954
|
+
## 후원
|
|
955
|
+
|
|
956
|
+
이 프로젝트가 도움이 되셨다면 커피 한 잔 부탁드립니다!
|
|
957
|
+
|
|
958
|
+
<a href="https://www.buymeacoffee.com/gracefullight" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
|
959
|
+
|
|
960
|
+
또는 스타를 눌러주세요:
|
|
961
|
+
|
|
962
|
+
```bash
|
|
963
|
+
gh api --method PUT /user/starred/gracefullight/pkgs
|
|
964
|
+
```
|
|
965
|
+
|
|
954
966
|
## 지원
|
|
955
967
|
|
|
956
968
|
- [문서](https://github.com/gracefullight/saju#readme)
|
package/README.md
CHANGED
|
@@ -38,8 +38,8 @@ This library calculates these pillars using:
|
|
|
38
38
|
## Installation
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
# Using
|
|
42
|
-
|
|
41
|
+
# Using bun
|
|
42
|
+
bun add @gracefullight/saju
|
|
43
43
|
|
|
44
44
|
# Using npm
|
|
45
45
|
npm install @gracefullight/saju
|
|
@@ -54,10 +54,10 @@ Choose one based on your preference:
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
# Option 1: Luxon (recommended for modern apps)
|
|
57
|
-
|
|
57
|
+
bun add luxon @types/luxon
|
|
58
58
|
|
|
59
59
|
# Option 2: date-fns (lightweight alternative)
|
|
60
|
-
|
|
60
|
+
bun add date-fns date-fns-tz
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
## Quick Start
|
|
@@ -803,22 +803,22 @@ git clone https://github.com/gracefullight/saju.git
|
|
|
803
803
|
cd saju
|
|
804
804
|
|
|
805
805
|
# Install dependencies
|
|
806
|
-
|
|
806
|
+
bun install
|
|
807
807
|
|
|
808
808
|
# Run tests
|
|
809
|
-
|
|
809
|
+
bun test
|
|
810
810
|
|
|
811
811
|
# Run tests with coverage
|
|
812
|
-
|
|
812
|
+
bun test:coverage
|
|
813
813
|
|
|
814
814
|
# Build
|
|
815
|
-
|
|
815
|
+
bun build
|
|
816
816
|
|
|
817
817
|
# Lint
|
|
818
|
-
|
|
818
|
+
bun lint
|
|
819
819
|
|
|
820
820
|
# Format
|
|
821
|
-
|
|
821
|
+
bun lint:fix
|
|
822
822
|
```
|
|
823
823
|
|
|
824
824
|
### Project Structure
|
|
@@ -851,13 +851,13 @@ packages/saju/
|
|
|
851
851
|
|
|
852
852
|
```bash
|
|
853
853
|
# Run all tests
|
|
854
|
-
|
|
854
|
+
bun test
|
|
855
855
|
|
|
856
856
|
# Run tests in watch mode
|
|
857
|
-
|
|
857
|
+
bun test:watch
|
|
858
858
|
|
|
859
859
|
# Generate coverage report
|
|
860
|
-
|
|
860
|
+
bun test:coverage
|
|
861
861
|
```
|
|
862
862
|
|
|
863
863
|
Coverage results:
|
|
@@ -951,6 +951,18 @@ This library is based on traditional Chinese calendar algorithms and astronomica
|
|
|
951
951
|
- [Luxon](https://moment.github.io/luxon/) - Modern date/time library
|
|
952
952
|
- [date-fns](https://date-fns.org/) - Modern JavaScript date utility library
|
|
953
953
|
|
|
954
|
+
## Sponsors
|
|
955
|
+
|
|
956
|
+
If this project helped you, please consider buying me a coffee!
|
|
957
|
+
|
|
958
|
+
<a href="https://www.buymeacoffee.com/gracefullight" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
|
959
|
+
|
|
960
|
+
Or leave a star:
|
|
961
|
+
|
|
962
|
+
```bash
|
|
963
|
+
gh api --method PUT /user/starred/gracefullight/pkgs
|
|
964
|
+
```
|
|
965
|
+
|
|
954
966
|
## Support
|
|
955
967
|
|
|
956
968
|
- [Documentation](https://github.com/gracefullight/saju#readme)
|
|
@@ -81,6 +81,7 @@ describe("relations", () => {
|
|
|
81
81
|
it("aggregates all relations", () => {
|
|
82
82
|
const result = analyzeRelations("甲子", "庚午", "丙寅", "壬申");
|
|
83
83
|
expect(result.all.length).toBe(result.combinations.length +
|
|
84
|
+
result.stemClashes.length +
|
|
84
85
|
result.clashes.length +
|
|
85
86
|
result.harms.length +
|
|
86
87
|
result.punishments.length +
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { analyzeTenGods, countElements, countTenGods, getBranchElement, getHiddenStems, getStemElement, getStemPolarity, getTenGodKey, getTenGodLabel, } from "../core/ten-gods";
|
|
2
|
+
import { analyzeTenGods, countElements, countTenGods, getBranchElement, getHiddenStems, getStemElement, getStemPolarity, getTenGodForBranch, getTenGodForStem, getTenGodKey, getTenGodLabel, } from "../core/ten-gods";
|
|
3
3
|
describe("ten-gods", () => {
|
|
4
4
|
describe("getStemElement", () => {
|
|
5
5
|
it("returns correct element for each stem", () => {
|
|
@@ -130,4 +130,36 @@ describe("ten-gods", () => {
|
|
|
130
130
|
expect(counts.fire).toBeGreaterThanOrEqual(1);
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
+
describe("getTenGodForStem", () => {
|
|
134
|
+
it("returns correct ten god label for stem", () => {
|
|
135
|
+
// 甲 (day master) -> 甲 (stem) = 비견 (companion)
|
|
136
|
+
const result1 = getTenGodForStem("甲", "甲");
|
|
137
|
+
expect(result1.key).toBe("companion");
|
|
138
|
+
expect(result1.korean).toBe("비견");
|
|
139
|
+
// 甲 (day master) -> 乙 (stem) = 겁재 (robWealth)
|
|
140
|
+
const result2 = getTenGodForStem("甲", "乙");
|
|
141
|
+
expect(result2.key).toBe("robWealth");
|
|
142
|
+
expect(result2.korean).toBe("겁재");
|
|
143
|
+
// 甲 (day master) -> 丙 (stem) = 식신 (eatingGod)
|
|
144
|
+
const result3 = getTenGodForStem("甲", "丙");
|
|
145
|
+
expect(result3.key).toBe("eatingGod");
|
|
146
|
+
expect(result3.korean).toBe("식신");
|
|
147
|
+
// 丙 (day master) -> 庚 (stem) = 편재 (indirectWealth)
|
|
148
|
+
const result4 = getTenGodForStem("丙", "庚");
|
|
149
|
+
expect(result4.key).toBe("indirectWealth");
|
|
150
|
+
expect(result4.korean).toBe("편재");
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe("getTenGodForBranch", () => {
|
|
154
|
+
it("returns correct ten god label for branch (first hidden stem)", () => {
|
|
155
|
+
// 甲 (day master) -> 子 (branch, hidden stem: 癸) = 정인 (directSeal)
|
|
156
|
+
const result1 = getTenGodForBranch("甲", "子");
|
|
157
|
+
expect(result1.key).toBe("directSeal");
|
|
158
|
+
expect(result1.korean).toBe("정인");
|
|
159
|
+
// 甲 (day master) -> 寅 (branch, hidden stem: 甲) = 비견 (companion)
|
|
160
|
+
const result2 = getTenGodForBranch("甲", "寅");
|
|
161
|
+
expect(result2.key).toBe("companion");
|
|
162
|
+
expect(result2.korean).toBe("비견");
|
|
163
|
+
});
|
|
164
|
+
});
|
|
133
165
|
});
|
|
@@ -14,17 +14,21 @@ describe("yongshen", () => {
|
|
|
14
14
|
expect(result.allElements[result.primary.key].isYongShen).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
it("identifies kishen elements correctly", () => {
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
// Use a balanced chart where 억부 method is used (not formation)
|
|
18
|
+
const result = analyzeYongShen("甲子", "丙寅", "庚申", "丁亥");
|
|
19
|
+
if (result.method.key !== "formation") {
|
|
20
|
+
const hasKiShen = Object.values(result.allElements).some((e) => e.isKiShen);
|
|
21
|
+
expect(hasKiShen).toBe(true);
|
|
22
|
+
}
|
|
20
23
|
});
|
|
21
24
|
it("uses 억부 method for 중화 strength (조후 is adjustment, not primary)", () => {
|
|
22
25
|
const result = analyzeYongShen("甲子", "丙寅", "庚申", "丁亥");
|
|
23
26
|
expect(["balance", "formation"]).toContain(result.method.key);
|
|
24
27
|
});
|
|
25
|
-
it("uses
|
|
28
|
+
it("uses formation method for extreme strength with 종강격", () => {
|
|
29
|
+
// All wood: extremely strong with no controller (metal) → 종강격
|
|
26
30
|
const result = analyzeYongShen("甲寅", "甲寅", "甲寅", "甲寅");
|
|
27
|
-
expect(result.method.key).toBe("
|
|
31
|
+
expect(result.method.key).toBe("formation");
|
|
28
32
|
});
|
|
29
33
|
it("includes johuAdjustment field in result", () => {
|
|
30
34
|
const result = analyzeYongShen("甲子", "丙寅", "甲辰", "乙亥");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"four-pillars.d.ts","sourceRoot":"","sources":["../../src/core/four-pillars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAgC,KAAK,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAE3B,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;CAAkB,CAAC;AACvC,eAAO,MAAM,OAAO;;;;CAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"four-pillars.d.ts","sourceRoot":"","sources":["../../src/core/four-pillars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAgC,KAAK,EAAE,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAE3B,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;CAAkB,CAAC;AACvC,eAAO,MAAM,OAAO;;;;CAAqB,CAAC;AAsD1C,wBAAgB,iBAAi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E,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/D,iBAAiB,EAAE,MAAM,CAAC;QAC1B,MAAM,EAAE,OAAO,MAAM,CAAC;KACvB,CAAC;CACH,CA8CA"}
|
|
@@ -13,6 +13,45 @@ export const TRADITIONAL_PRESET = {
|
|
|
13
13
|
};
|
|
14
14
|
export const presetA = STANDARD_PRESET;
|
|
15
15
|
export const presetB = TRADITIONAL_PRESET;
|
|
16
|
+
/**
|
|
17
|
+
* Korea DST period: 1987-05-10 02:00 ~ 1988-10-08 03:00 (UTC+10)
|
|
18
|
+
* Returns the effective timezone offset in hours for a Korean datetime.
|
|
19
|
+
*/
|
|
20
|
+
function getEffectiveKSTOffset(adapter, dtLocal) {
|
|
21
|
+
const y = adapter.getYear(dtLocal);
|
|
22
|
+
const m = adapter.getMonth(dtLocal);
|
|
23
|
+
const d = adapter.getDay(dtLocal);
|
|
24
|
+
const h = adapter.getHour(dtLocal);
|
|
25
|
+
// KDT start: 1987-05-10 02:00 KST (becomes 03:00 KDT)
|
|
26
|
+
// KDT end: 1988-10-08 03:00 KDT (becomes 02:00 KST)
|
|
27
|
+
const afterStart = y > 1987 || (y === 1987 && (m > 5 || (m === 5 && (d > 10 || (d === 10 && h >= 2)))));
|
|
28
|
+
const beforeEnd = y < 1988 || (y === 1988 && (m < 10 || (m === 10 && (d < 8 || (d === 8 && h < 3)))));
|
|
29
|
+
return afterStart && beforeEnd ? 10 : 9;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Approximate ΔT (TT - UT) in seconds.
|
|
33
|
+
* Based on polynomial expressions from Meeus / USNO.
|
|
34
|
+
*/
|
|
35
|
+
function deltaT(year) {
|
|
36
|
+
if (year >= 2005 && year < 2050) {
|
|
37
|
+
const t = year - 2000;
|
|
38
|
+
return 62.92 + 0.32217 * t + 0.005589 * t * t;
|
|
39
|
+
}
|
|
40
|
+
if (year >= 1986 && year < 2005) {
|
|
41
|
+
const t = year - 2000;
|
|
42
|
+
return (63.86 +
|
|
43
|
+
0.3345 * t -
|
|
44
|
+
0.060374 * t * t +
|
|
45
|
+
0.0017275 * t * t * t +
|
|
46
|
+
0.000651814 * t * t * t * t +
|
|
47
|
+
0.00002373599 * t * t * t * t * t);
|
|
48
|
+
}
|
|
49
|
+
if (year >= 1900 && year < 1986) {
|
|
50
|
+
const t = year - 1900;
|
|
51
|
+
return -0.02 + 0.000297 * t * t;
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
16
55
|
function normDeg(x) {
|
|
17
56
|
x %= 360;
|
|
18
57
|
return x < 0 ? x + 360 : x;
|
|
@@ -38,7 +77,10 @@ function sunApparentLongitude(adapter, dtUtc) {
|
|
|
38
77
|
const A = Math.floor(y / 100);
|
|
39
78
|
const B = 2 - A + Math.floor(A / 4);
|
|
40
79
|
const JD = Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + d + B - 1524.5;
|
|
41
|
-
|
|
80
|
+
// Apply ΔT correction for TT
|
|
81
|
+
const dtSeconds = deltaT(y);
|
|
82
|
+
const JD_TT = JD + dtSeconds / 86400.0;
|
|
83
|
+
const T = (JD_TT - 2451545.0) / 36525.0;
|
|
42
84
|
const L0 = normDeg(280.46646 + 36000.76983 * T + 0.0003032 * T * T);
|
|
43
85
|
const M = normDeg(357.52911 + 35999.05029 * T - 0.0001537 * T * T);
|
|
44
86
|
const deg2rad = (deg) => (deg * Math.PI) / 180;
|
|
@@ -171,7 +213,8 @@ export function hourPillar(dtLocal, { adapter, longitudeDeg, tzOffsetHours = 9,
|
|
|
171
213
|
return { pillar: STEMS[hs] + BRANCHES[hb], adjustedDt: dtUsed, effectiveDate: effDate };
|
|
172
214
|
}
|
|
173
215
|
export function getFourPillars(dtLocal, { adapter, longitudeDeg, tzOffsetHours = 9, preset = presetA, }) {
|
|
174
|
-
const
|
|
216
|
+
const effectiveTzOffset = tzOffsetHours === 9 ? getEffectiveKSTOffset(adapter, dtLocal) : tzOffsetHours;
|
|
217
|
+
const effectiveLongitude = longitudeDeg ?? effectiveTzOffset * 15;
|
|
175
218
|
const dayBoundary = preset.dayBoundary ?? "midnight";
|
|
176
219
|
const useMeanSolarTimeForHour = preset.useMeanSolarTimeForHour ?? false;
|
|
177
220
|
const useMeanSolarTimeForBoundary = preset.useMeanSolarTimeForBoundary ?? false;
|
|
@@ -181,14 +224,14 @@ export function getFourPillars(dtLocal, { adapter, longitudeDeg, tzOffsetHours =
|
|
|
181
224
|
adapter,
|
|
182
225
|
dayBoundary,
|
|
183
226
|
longitudeDeg: effectiveLongitude,
|
|
184
|
-
tzOffsetHours,
|
|
227
|
+
tzOffsetHours: effectiveTzOffset,
|
|
185
228
|
useMeanSolarTimeForBoundary,
|
|
186
229
|
});
|
|
187
230
|
const d = dayPillarFromDate(effDate);
|
|
188
231
|
const h = hourPillar(dtLocal, {
|
|
189
232
|
adapter,
|
|
190
233
|
longitudeDeg: effectiveLongitude,
|
|
191
|
-
tzOffsetHours,
|
|
234
|
+
tzOffsetHours: effectiveTzOffset,
|
|
192
235
|
useMeanSolarTimeForHour,
|
|
193
236
|
dayBoundary,
|
|
194
237
|
useMeanSolarTimeForBoundary,
|
package/dist/core/luck.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DateAdapter } from "../adapters/date-adapter";
|
|
2
|
+
import { type SolarTermKey } from "../core/solar-terms";
|
|
2
3
|
import type { Gender, Polarity } from "../types";
|
|
3
4
|
export type { Gender };
|
|
4
5
|
export interface LuckPillar {
|
|
@@ -45,6 +46,11 @@ export interface MonthlyLuckResult {
|
|
|
45
46
|
stem: string;
|
|
46
47
|
branch: string;
|
|
47
48
|
pillar: string;
|
|
49
|
+
solarTerm: {
|
|
50
|
+
key: SolarTermKey;
|
|
51
|
+
korean: string;
|
|
52
|
+
hanja: string;
|
|
53
|
+
};
|
|
48
54
|
}
|
|
49
55
|
export declare function calculateMonthlyLuck(year: number, fromMonth: number, toMonth: number): MonthlyLuckResult[];
|
|
50
56
|
export interface DailyLuckResult {
|
package/dist/core/luck.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"luck.d.ts","sourceRoot":"","sources":["../../src/core/luck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"luck.d.ts","sourceRoot":"","sources":["../../src/core/luck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGhD,YAAY,EAAE,MAAM,EAAE,CAAC;AAEvB,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,MAAM,EACd,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Z,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,eAAe,EAAE,CAqBnB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAWlE"}
|
package/dist/core/luck.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getSolarTermLabel } from "../core/solar-terms";
|
|
1
2
|
import { getStemPolarity } from "../core/ten-gods";
|
|
2
3
|
import { BRANCHES, getPillarIndex, jdnFromDate, pillarFromIndex, STEMS } from "../utils";
|
|
3
4
|
export function calculateMajorLuck(birthDateTime, gender, yearPillar, monthPillar, options) {
|
|
@@ -79,6 +80,20 @@ export function getCurrentMajorLuck(majorLuck, age) {
|
|
|
79
80
|
}
|
|
80
81
|
return null;
|
|
81
82
|
}
|
|
83
|
+
const MONTH_JIE_KEYS = [
|
|
84
|
+
"springBegins",
|
|
85
|
+
"awakeningInsects",
|
|
86
|
+
"pureBrightness",
|
|
87
|
+
"summerBegins",
|
|
88
|
+
"grainInEar",
|
|
89
|
+
"minorHeat",
|
|
90
|
+
"autumnBegins",
|
|
91
|
+
"whiteDew",
|
|
92
|
+
"coldDew",
|
|
93
|
+
"winterBegins",
|
|
94
|
+
"majorSnow",
|
|
95
|
+
"minorCold",
|
|
96
|
+
];
|
|
82
97
|
export function calculateMonthlyLuck(year, fromMonth, toMonth) {
|
|
83
98
|
const results = [];
|
|
84
99
|
const yearIdx60 = (((year - 1984) % 60) + 60) % 60;
|
|
@@ -92,12 +107,19 @@ export function calculateMonthlyLuck(year, fromMonth, toMonth) {
|
|
|
92
107
|
const stem = STEMS[stemIdx];
|
|
93
108
|
const branch = BRANCHES[branchIdx];
|
|
94
109
|
const pillar = stem + branch;
|
|
110
|
+
const jieKey = MONTH_JIE_KEYS[monthOffset % 12];
|
|
111
|
+
const jieLabel = getSolarTermLabel(jieKey);
|
|
95
112
|
results.push({
|
|
96
113
|
year,
|
|
97
114
|
month,
|
|
98
115
|
stem,
|
|
99
116
|
branch,
|
|
100
117
|
pillar,
|
|
118
|
+
solarTerm: {
|
|
119
|
+
key: jieLabel.key,
|
|
120
|
+
korean: jieLabel.korean,
|
|
121
|
+
hanja: jieLabel.hanja,
|
|
122
|
+
},
|
|
101
123
|
});
|
|
102
124
|
}
|
|
103
125
|
return results;
|
|
@@ -106,7 +128,7 @@ export function calculateDailyLuck(year, month, fromDay, toDay) {
|
|
|
106
128
|
const results = [];
|
|
107
129
|
for (let day = fromDay; day <= toDay; day++) {
|
|
108
130
|
const jdn = jdnFromDate(year, month, day);
|
|
109
|
-
const idx60 = (((jdn
|
|
131
|
+
const idx60 = (((jdn - 11) % 60) + 60) % 60;
|
|
110
132
|
const stem = STEMS[idx60 % 10];
|
|
111
133
|
const branch = BRANCHES[idx60 % 12];
|
|
112
134
|
const pillar = stem + branch;
|
|
@@ -123,7 +145,7 @@ export function calculateDailyLuck(year, month, fromDay, toDay) {
|
|
|
123
145
|
}
|
|
124
146
|
export function getDayPillar(year, month, day) {
|
|
125
147
|
const jdn = jdnFromDate(year, month, day);
|
|
126
|
-
const idx60 = (((jdn
|
|
148
|
+
const idx60 = (((jdn - 11) % 60) + 60) % 60;
|
|
127
149
|
return STEMS[idx60 % 10] + BRANCHES[idx60 % 12];
|
|
128
150
|
}
|
|
129
151
|
export function getMonthPillar(year, month) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Element } from "../types";
|
|
2
|
+
export interface NayinResult {
|
|
3
|
+
element: Element;
|
|
4
|
+
korean: string;
|
|
5
|
+
hanja: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function getNayin(pillarIdx60: number): NayinResult;
|
|
8
|
+
export declare function getNayinFromPillar(pillar: string): NayinResult;
|
|
9
|
+
export interface FourPillarsNayin {
|
|
10
|
+
year: NayinResult;
|
|
11
|
+
month: NayinResult;
|
|
12
|
+
day: NayinResult;
|
|
13
|
+
hour: NayinResult;
|
|
14
|
+
}
|
|
15
|
+
export declare function analyzeFourPillarsNayin(yearPillar: string, monthPillar: string, dayPillar: string, hourPillar: string): FourPillarsNayin;
|
|
16
|
+
//# sourceMappingURL=nayin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nayin.d.ts","sourceRoot":"","sources":["../../src/core/nayin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAkEvC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAMzD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAG9D;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;IACnB,GAAG,EAAE,WAAW,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,gBAAgB,CAOlB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getPillarIndex } from "../utils";
|
|
2
|
+
const NAYIN_TABLE = {
|
|
3
|
+
0: { element: "metal", korean: "해중금", hanja: "海中金" },
|
|
4
|
+
1: { element: "metal", korean: "해중금", hanja: "海中金" },
|
|
5
|
+
2: { element: "fire", korean: "노중화", hanja: "爐中火" },
|
|
6
|
+
3: { element: "fire", korean: "노중화", hanja: "爐中火" },
|
|
7
|
+
4: { element: "wood", korean: "대림목", hanja: "大林木" },
|
|
8
|
+
5: { element: "wood", korean: "대림목", hanja: "大林木" },
|
|
9
|
+
6: { element: "earth", korean: "노방토", hanja: "路傍土" },
|
|
10
|
+
7: { element: "earth", korean: "노방토", hanja: "路傍土" },
|
|
11
|
+
8: { element: "metal", korean: "검봉금", hanja: "劍鋒金" },
|
|
12
|
+
9: { element: "metal", korean: "검봉금", hanja: "劍鋒金" },
|
|
13
|
+
10: { element: "fire", korean: "산두화", hanja: "山頭火" },
|
|
14
|
+
11: { element: "fire", korean: "산두화", hanja: "山頭火" },
|
|
15
|
+
12: { element: "water", korean: "간하수", hanja: "澗下水" },
|
|
16
|
+
13: { element: "water", korean: "간하수", hanja: "澗下水" },
|
|
17
|
+
14: { element: "earth", korean: "성두토", hanja: "城頭土" },
|
|
18
|
+
15: { element: "earth", korean: "성두토", hanja: "城頭土" },
|
|
19
|
+
16: { element: "metal", korean: "백랍금", hanja: "白蠟金" },
|
|
20
|
+
17: { element: "metal", korean: "백랍금", hanja: "白蠟金" },
|
|
21
|
+
18: { element: "wood", korean: "양류목", hanja: "楊柳木" },
|
|
22
|
+
19: { element: "wood", korean: "양류목", hanja: "楊柳木" },
|
|
23
|
+
20: { element: "water", korean: "천천수", hanja: "泉中水" },
|
|
24
|
+
21: { element: "water", korean: "천천수", hanja: "泉中水" },
|
|
25
|
+
22: { element: "earth", korean: "옥상토", hanja: "屋上土" },
|
|
26
|
+
23: { element: "earth", korean: "옥상토", hanja: "屋上土" },
|
|
27
|
+
24: { element: "fire", korean: "벽력화", hanja: "霹靂火" },
|
|
28
|
+
25: { element: "fire", korean: "벽력화", hanja: "霹靂火" },
|
|
29
|
+
26: { element: "wood", korean: "송백목", hanja: "松柏木" },
|
|
30
|
+
27: { element: "wood", korean: "송백목", hanja: "松柏木" },
|
|
31
|
+
28: { element: "water", korean: "장류수", hanja: "長流水" },
|
|
32
|
+
29: { element: "water", korean: "장류수", hanja: "長流水" },
|
|
33
|
+
30: { element: "metal", korean: "사중금", hanja: "砂中金" },
|
|
34
|
+
31: { element: "metal", korean: "사중금", hanja: "砂中金" },
|
|
35
|
+
32: { element: "fire", korean: "산하화", hanja: "山下火" },
|
|
36
|
+
33: { element: "fire", korean: "산하화", hanja: "山下火" },
|
|
37
|
+
34: { element: "wood", korean: "평지목", hanja: "平地木" },
|
|
38
|
+
35: { element: "wood", korean: "평지목", hanja: "平地木" },
|
|
39
|
+
36: { element: "earth", korean: "벽상토", hanja: "壁上土" },
|
|
40
|
+
37: { element: "earth", korean: "벽상토", hanja: "壁上土" },
|
|
41
|
+
38: { element: "metal", korean: "금박금", hanja: "金箔金" },
|
|
42
|
+
39: { element: "metal", korean: "금박금", hanja: "金箔金" },
|
|
43
|
+
40: { element: "fire", korean: "복등화", hanja: "覆燈火" },
|
|
44
|
+
41: { element: "fire", korean: "복등화", hanja: "覆燈火" },
|
|
45
|
+
42: { element: "water", korean: "천하수", hanja: "天河水" },
|
|
46
|
+
43: { element: "water", korean: "천하수", hanja: "天河水" },
|
|
47
|
+
44: { element: "earth", korean: "대역토", hanja: "大驛土" },
|
|
48
|
+
45: { element: "earth", korean: "대역토", hanja: "大驛土" },
|
|
49
|
+
46: { element: "metal", korean: "채광금", hanja: "釵釧金" },
|
|
50
|
+
47: { element: "metal", korean: "채광금", hanja: "釵釧金" },
|
|
51
|
+
48: { element: "wood", korean: "상자목", hanja: "桑柘木" },
|
|
52
|
+
49: { element: "wood", korean: "상자목", hanja: "桑柘木" },
|
|
53
|
+
50: { element: "water", korean: "대계수", hanja: "大溪水" },
|
|
54
|
+
51: { element: "water", korean: "대계수", hanja: "大溪水" },
|
|
55
|
+
52: { element: "earth", korean: "사중토", hanja: "砂中土" },
|
|
56
|
+
53: { element: "earth", korean: "사중토", hanja: "砂中土" },
|
|
57
|
+
54: { element: "fire", korean: "천상화", hanja: "天上火" },
|
|
58
|
+
55: { element: "fire", korean: "천상화", hanja: "天上火" },
|
|
59
|
+
56: { element: "wood", korean: "석류목", hanja: "石榴木" },
|
|
60
|
+
57: { element: "wood", korean: "석류목", hanja: "石榴木" },
|
|
61
|
+
58: { element: "water", korean: "대해수", hanja: "大海水" },
|
|
62
|
+
59: { element: "water", korean: "대해수", hanja: "大海水" },
|
|
63
|
+
};
|
|
64
|
+
export function getNayin(pillarIdx60) {
|
|
65
|
+
const normalized = ((pillarIdx60 % 60) + 60) % 60;
|
|
66
|
+
const pairIdx = Math.floor(normalized / 2) * 2;
|
|
67
|
+
const entry = NAYIN_TABLE[pairIdx];
|
|
68
|
+
if (!entry)
|
|
69
|
+
throw new Error(`Invalid pillar index: ${pillarIdx60}`);
|
|
70
|
+
return { element: entry.element, korean: entry.korean, hanja: entry.hanja };
|
|
71
|
+
}
|
|
72
|
+
export function getNayinFromPillar(pillar) {
|
|
73
|
+
const idx = getPillarIndex(pillar);
|
|
74
|
+
return getNayin(idx);
|
|
75
|
+
}
|
|
76
|
+
export function analyzeFourPillarsNayin(yearPillar, monthPillar, dayPillar, hourPillar) {
|
|
77
|
+
return {
|
|
78
|
+
year: getNayin(getPillarIndex(yearPillar)),
|
|
79
|
+
month: getNayin(getPillarIndex(monthPillar)),
|
|
80
|
+
day: getNayin(getPillarIndex(dayPillar)),
|
|
81
|
+
hour: getNayin(getPillarIndex(hourPillar)),
|
|
82
|
+
};
|
|
83
|
+
}
|
package/dist/core/relations.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Element, ElementLabel } from "../core/ten-gods";
|
|
2
2
|
import type { Label } from "../types";
|
|
3
|
-
export declare const RELATION_TYPE_KEYS: readonly ["stemCombination", "sixCombination", "tripleCombination", "directionalCombination", "clash", "harm", "punishment", "destruction"];
|
|
3
|
+
export declare const RELATION_TYPE_KEYS: readonly ["stemCombination", "stemClash", "sixCombination", "halfCombination", "tripleCombination", "directionalCombination", "clash", "harm", "punishment", "destruction"];
|
|
4
4
|
export type RelationTypeKey = (typeof RELATION_TYPE_KEYS)[number];
|
|
5
5
|
export interface RelationTypeLabel extends Label<RelationTypeKey> {
|
|
6
6
|
}
|
|
@@ -20,11 +20,17 @@ export type StemCombinationResult = {
|
|
|
20
20
|
resultElement: Element;
|
|
21
21
|
};
|
|
22
22
|
export declare const STEM_COMBINATIONS: StemCombinationResult[];
|
|
23
|
+
export declare const STEM_CLASHES: [string, string][];
|
|
23
24
|
export type BranchCombinationResult = {
|
|
24
25
|
branches: [string, string];
|
|
25
26
|
resultElement: Element;
|
|
26
27
|
};
|
|
27
28
|
export declare const BRANCH_SIX_COMBINATIONS: BranchCombinationResult[];
|
|
29
|
+
export type HalfCombinationResult = {
|
|
30
|
+
branches: [string, string];
|
|
31
|
+
resultElement: Element;
|
|
32
|
+
};
|
|
33
|
+
export declare const BRANCH_HALF_COMBINATIONS: HalfCombinationResult[];
|
|
28
34
|
export type TripleCombinationResult = {
|
|
29
35
|
branches: [string, string, string];
|
|
30
36
|
resultElement: Element;
|
|
@@ -46,6 +52,11 @@ export interface StemCombination {
|
|
|
46
52
|
transformStatus: TransformationStatusLabel;
|
|
47
53
|
transformReason: string;
|
|
48
54
|
}
|
|
55
|
+
export interface StemClash {
|
|
56
|
+
type: RelationTypeLabel;
|
|
57
|
+
pair: [string, string];
|
|
58
|
+
positions: [string, string];
|
|
59
|
+
}
|
|
49
60
|
export interface BranchSixCombination {
|
|
50
61
|
type: RelationTypeLabel;
|
|
51
62
|
pair: [string, string];
|
|
@@ -54,6 +65,12 @@ export interface BranchSixCombination {
|
|
|
54
65
|
transformStatus: TransformationStatusLabel;
|
|
55
66
|
transformReason: string;
|
|
56
67
|
}
|
|
68
|
+
export interface BranchHalfCombination {
|
|
69
|
+
type: RelationTypeLabel;
|
|
70
|
+
pair: [string, string];
|
|
71
|
+
positions: [string, string];
|
|
72
|
+
resultElement: ElementLabel;
|
|
73
|
+
}
|
|
57
74
|
export interface BranchTripleCombination {
|
|
58
75
|
type: RelationTypeLabel;
|
|
59
76
|
branches: string[];
|
|
@@ -93,9 +110,10 @@ export interface BranchDestruction {
|
|
|
93
110
|
pair: [string, string];
|
|
94
111
|
positions: [string, string];
|
|
95
112
|
}
|
|
96
|
-
export type Relation = StemCombination | BranchSixCombination | BranchTripleCombination | BranchDirectionalCombination | BranchClash | BranchHarm | BranchPunishment | BranchDestruction;
|
|
113
|
+
export type Relation = StemCombination | StemClash | BranchSixCombination | BranchHalfCombination | BranchTripleCombination | BranchDirectionalCombination | BranchClash | BranchHarm | BranchPunishment | BranchDestruction;
|
|
97
114
|
export interface RelationsResult {
|
|
98
|
-
combinations: (StemCombination | BranchSixCombination | BranchTripleCombination | BranchDirectionalCombination)[];
|
|
115
|
+
combinations: (StemCombination | BranchSixCombination | BranchHalfCombination | BranchTripleCombination | BranchDirectionalCombination)[];
|
|
116
|
+
stemClashes: StemClash[];
|
|
99
117
|
clashes: BranchClash[];
|
|
100
118
|
harms: BranchHarm[];
|
|
101
119
|
punishments: BranchPunishment[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/core/relations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/core/relations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,kBAAkB,6KAWrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC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