Comparing version 2.1.0 to 2.2.0
@@ -10,2 +10,16 @@ # 紫微斗数 | ||
## v2.2.0 | ||
- 🪄 功能(feature) | ||
🇨🇳 | ||
- 新增童限指示 #154 | ||
- 新增小限12宫 #157 | ||
🇺🇸 | ||
- add childhood scope indicator #154 | ||
- add 12 palaces for age #157 | ||
## v2.1.0 | ||
@@ -12,0 +26,0 @@ |
@@ -61,2 +61,3 @@ "use strict"; | ||
palaces.push(new FunctionalPalace_1.default({ | ||
index: i, | ||
name: palaceNames[i], | ||
@@ -63,0 +64,0 @@ isBodyPalace: bodyIndex === i, |
@@ -43,7 +43,10 @@ "use strict"; | ||
// 虚岁 | ||
var nominalAge = Math.max(_date.lunarYear - _birthday.lunarYear, 1); | ||
var nominalAge = _date.lunarYear - _birthday.lunarYear; | ||
// 是否童限 | ||
var isChildhood = false; | ||
// 假如目标日期已经过了生日,则需要加1岁 | ||
// 比如 2022年九月初一 出生的人,在出生后虚岁为 1 岁 | ||
// 但在 2023年九月初二 以后,虚岁则为 2 岁 | ||
if ((_date.lunarMonth === _birthday.lunarMonth && _date.lunarDay > _birthday.lunarDay) || | ||
if (((_date.lunarYear === _birthday.lunarYear && _date.lunarMonth) === _birthday.lunarMonth && | ||
_date.lunarDay > _birthday.lunarDay) || | ||
_date.lunarMonth > _birthday.lunarMonth) { | ||
@@ -68,2 +71,6 @@ nominalAge += 1; | ||
var hourlyIndex = -1; | ||
// 小限天干 | ||
var heavenlyStemOfAge = 'jia'; | ||
// 小限地支 | ||
var earthlyBranchOfAge = 'zi'; | ||
// 查询大限索引 | ||
@@ -79,7 +86,24 @@ $.palaces.some(function (_a, index) { | ||
}); | ||
if (decadalIndex < 0) { | ||
// 如果大限索引小于0则证明还没有开始起运 | ||
// 此时应该取小限运 | ||
// 一命二财三疾厄 四岁夫妻五福德 | ||
// 六岁事业为童限 专就宫垣视吉凶 | ||
var palaces = ['命宫', '财帛', '疾厄', '夫妻', '福德', '官禄']; | ||
var targetIndex = palaces[nominalAge - 1]; | ||
var targetPalace = $.palace(targetIndex); | ||
if (targetPalace) { | ||
isChildhood = true; | ||
decadalIndex = targetPalace.index; | ||
heavenlyStemOfDecade = targetPalace.heavenlyStem; | ||
earthlyBranchOfDecade = targetPalace.earthlyBranch; | ||
} | ||
} | ||
// 查询小限索引 | ||
$.palaces.some(function (_a, index) { | ||
var ages = _a.ages; | ||
var ages = _a.ages, heavenlyStem = _a.heavenlyStem, earthlyBranch = _a.earthlyBranch; | ||
if (ages.includes(nominalAge)) { | ||
ageIndex = index; | ||
heavenlyStemOfAge = heavenlyStem; | ||
earthlyBranchOfAge = earthlyBranch; | ||
return true; | ||
@@ -102,3 +126,3 @@ } | ||
index: decadalIndex, | ||
name: (0, i18n_1.t)('decadal'), | ||
name: isChildhood ? (0, i18n_1.t)('childhood') : (0, i18n_1.t)('decadal'), | ||
heavenlyStem: (0, i18n_1.t)((0, i18n_1.kot)(heavenlyStemOfDecade, 'Heavnly')), | ||
@@ -114,2 +138,6 @@ earthlyBranch: (0, i18n_1.t)((0, i18n_1.kot)(earthlyBranchOfDecade, 'Earthly')), | ||
name: (0, i18n_1.t)('turn'), | ||
heavenlyStem: heavenlyStemOfAge, | ||
earthlyBranch: earthlyBranchOfAge, | ||
palaceNames: (0, palace_1.getPalaceNames)(ageIndex), | ||
mutagen: (0, utils_1.getMutagensByHeavenlyStem)(heavenlyStemOfAge), | ||
}, | ||
@@ -116,0 +144,0 @@ yearly: { |
@@ -85,6 +85,4 @@ import { Horoscope, Scope } from '../data/types'; | ||
decadal: import("../data/types").HoroscopeItem; | ||
age: { | ||
index: number; | ||
age: import("../data/types").HoroscopeItem & { | ||
nominalAge: number; | ||
name: string; | ||
}; | ||
@@ -91,0 +89,0 @@ yearly: import("../data/types").HoroscopeItem & { |
@@ -159,2 +159,3 @@ import { Palace } from '../data/types'; | ||
private _astrolabe?; | ||
index: number; | ||
name: PalaceName; | ||
@@ -161,0 +162,0 @@ isBodyPalace: boolean; |
@@ -106,2 +106,3 @@ "use strict"; | ||
}; | ||
this.index = data.index; | ||
this.name = data.name; | ||
@@ -108,0 +109,0 @@ this.isBodyPalace = data.isBodyPalace; |
@@ -70,12 +70,7 @@ import { IFunctionalPalace } from '../../astro/FunctionalPalace'; | ||
* @property | ||
* - index 小限所在宫位索引 | ||
* - nominalAge 虚岁 | ||
*/ | ||
age: { | ||
/** 小限所在宫位索引 */ | ||
index: number; | ||
age: HoroscopeItem & { | ||
/** 虚岁 */ | ||
nominalAge: number; | ||
/** 名称 */ | ||
name: string; | ||
}; | ||
@@ -82,0 +77,0 @@ /** 流年 */ |
@@ -44,2 +44,4 @@ import { IFunctionalPalace } from '../../astro/FunctionalPalace'; | ||
export type Palace = { | ||
/** 宫位索引 */ | ||
index: number; | ||
/** 宫位名称 */ | ||
@@ -46,0 +48,0 @@ name: PalaceName; |
{ | ||
"decadal": "大限", | ||
"childhood": "子供", | ||
"yearly": "流年", | ||
@@ -4,0 +5,0 @@ "monthly": "流月", |
@@ -187,2 +187,3 @@ declare const _default: { | ||
decadal: string; | ||
childhood: string; | ||
yearly: string; | ||
@@ -189,0 +190,0 @@ monthly: string; |
{ | ||
"decadal": "대한", | ||
"childhood": "어린", | ||
"yearly": "유년", | ||
@@ -4,0 +5,0 @@ "monthly": "유월", |
@@ -187,2 +187,3 @@ declare const _default: { | ||
decadal: string; | ||
childhood: string; | ||
yearly: string; | ||
@@ -189,0 +190,0 @@ monthly: string; |
{ | ||
"decadal": "Đại Hạn", | ||
"childhood": "đứa trẻ Hạn", | ||
"yearly": "Lưu Niên", | ||
@@ -4,0 +5,0 @@ "monthly": "Lưu Nguyệt", |
@@ -187,2 +187,3 @@ declare const _default: { | ||
decadal: string; | ||
childhood: string; | ||
yearly: string; | ||
@@ -189,0 +190,0 @@ monthly: string; |
{ | ||
"decadal": "大限", | ||
"childhood": "童限", | ||
"yearly": "流年", | ||
@@ -4,0 +5,0 @@ "monthly": "流月", |
@@ -187,2 +187,3 @@ declare const _default: { | ||
decadal: string; | ||
childhood: string; | ||
yearly: string; | ||
@@ -189,0 +190,0 @@ monthly: string; |
{ | ||
"decadal": "大限", | ||
"childhood": "童限", | ||
"yearly": "流年", | ||
@@ -4,0 +5,0 @@ "monthly": "流月", |
@@ -187,2 +187,3 @@ declare const _default: { | ||
decadal: string; | ||
childhood: string; | ||
yearly: string; | ||
@@ -189,0 +190,0 @@ monthly: string; |
{ | ||
"name": "iztro", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。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 from the astrolabe", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1128959
13163