Comparing version 1.3.0 to 1.3.1
@@ -10,2 +10,14 @@ # 紫微斗数 @sylarlong/astro | ||
## v1.3.1 | ||
- 🛠️ 修复(fix) | ||
🇨🇳 | ||
- 天干地支在翻译时会出现译文一样而导致结果错误 #64 | ||
🇺🇸 | ||
- heavenly stem and earthly branch translation issue #31 | ||
## v1.3.0 | ||
@@ -12,0 +24,0 @@ |
@@ -35,3 +35,3 @@ "use strict"; | ||
var yearly = (0, calendar_1.getHeavenlyStemAndEarthlyBranchBySolarDate)(solarDateStr, timeIndex).yearly; | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(yearly[1]); | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(yearly[1], 'Earthly'); | ||
var _a = (0, palace_1.getSoulAndBody)(solarDateStr, timeIndex, fixLeap), bodyIndex = _a.bodyIndex, soulIndex = _a.soulIndex, heavenlyStemOfSoul = _a.heavenlyStemOfSoul, earthlyBranchOfSoul = _a.earthlyBranchOfSoul; | ||
@@ -47,3 +47,3 @@ var palaceNames = (0, palace_1.getPalaceNames)(soulIndex); | ||
for (var i = 0; i < 12; i++) { | ||
var heavenlyStemOfPalace = data_1.HEAVENLY_STEMS[(0, utils_1.fixIndex)(data_1.HEAVENLY_STEMS.indexOf((0, i18n_1.kot)(heavenlyStemOfSoul)) - soulIndex + i, 10)]; | ||
var heavenlyStemOfPalace = data_1.HEAVENLY_STEMS[(0, utils_1.fixIndex)(data_1.HEAVENLY_STEMS.indexOf((0, i18n_1.kot)(heavenlyStemOfSoul, 'Heavenly')) - soulIndex + i, 10)]; | ||
var earthlyBranchOfPalace = data_1.EARTHLY_BRANCHES[(0, utils_1.fixIndex)(2 + i)]; | ||
@@ -50,0 +50,0 @@ palaces.push(new FunctionalPalace_1.default({ |
@@ -93,3 +93,3 @@ "use strict"; | ||
// 获取流时索引 | ||
hourlyIndex = (0, utils_1.fixIndex)(dailyIndex + data_1.EARTHLY_BRANCHES.indexOf((0, i18n_1.kot)(hourly[1]))); | ||
hourlyIndex = (0, utils_1.fixIndex)(dailyIndex + data_1.EARTHLY_BRANCHES.indexOf((0, i18n_1.kot)(hourly[1], 'Earthly'))); | ||
var scope = { | ||
@@ -96,0 +96,0 @@ solarDate: (0, calendar_1.normalizeSolarDateStr)(targetDate).join('-'), |
@@ -27,4 +27,4 @@ "use strict"; | ||
var _a = (0, calendar_1.getHeavenlyStemAndEarthlyBranchBySolarDate)(solarDate, timeIndex), yearly = _a.yearly, hourly = _a.hourly; | ||
var earthlyBranchOfTime = (0, i18n_1.kot)(hourly[1]); | ||
var heavenlyStemOfYear = (0, i18n_1.kot)(yearly[0]); | ||
var earthlyBranchOfTime = (0, i18n_1.kot)(hourly[1], 'Earthly'); | ||
var heavenlyStemOfYear = (0, i18n_1.kot)(yearly[0], 'Heavenly'); | ||
// 紫微斗数以`寅`宫为第一个宫位 | ||
@@ -101,4 +101,4 @@ var firstIndex = data_1.EARTHLY_BRANCHES.indexOf('yinEarthly'); | ||
var fiveElementsTable = ['wood3rd', 'metal4th', 'water2nd', 'fire6th', 'earth5th']; | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
var heavenlyStemNumber = Math.floor(data_1.HEAVENLY_STEMS.indexOf(heavenlyStem) / 2) + 1; | ||
@@ -144,4 +144,4 @@ var earthlyBranchNumber = Math.floor((0, utils_1.fixIndex)(data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch), 6) / 2) + 1; | ||
var yearly = (0, calendar_1.getHeavenlyStemAndEarthlyBranchBySolarDate)(solarDateStr, timeIndex).yearly; | ||
var heavenlyStem = (0, i18n_1.kot)(yearly[0]); | ||
var earthlyBranch = (0, i18n_1.kot)(yearly[1]); | ||
var heavenlyStem = (0, i18n_1.kot)(yearly[0], 'Heavenly'); | ||
var earthlyBranch = (0, i18n_1.kot)(yearly[1], 'Earthly'); | ||
var _a = (0, exports.getSoulAndBody)(solarDateStr, timeIndex, fixLeap), soulIndex = _a.soulIndex, heavenlyStemOfSoul = _a.heavenlyStemOfSoul, earthlyBranchOfSoul = _a.earthlyBranchOfSoul; | ||
@@ -148,0 +148,0 @@ var fiveElementsClass = (0, i18n_1.kot)((0, exports.getFiveElementsClass)(heavenlyStemOfSoul, earthlyBranchOfSoul)); |
@@ -78,3 +78,3 @@ "use strict"; | ||
var heavenlyStemAndEarthlyBranchOfTime = function (timeIndex, heavenlyStemNameOfDay) { | ||
var heavenlyStemOfDay = (0, i18n_1.kot)(heavenlyStemNameOfDay); | ||
var heavenlyStemOfDay = (0, i18n_1.kot)(heavenlyStemNameOfDay, 'Heavenly'); | ||
var startHeavenlyStem = data_1.RAT_RULE[heavenlyStemOfDay]; | ||
@@ -81,0 +81,0 @@ var heavenlyStem = data_1.HEAVENLY_STEMS[(0, utils_1.fixIndex)(data_1.HEAVENLY_STEMS.indexOf(startHeavenlyStem) + (0, utils_1.fixIndex)(timeIndex), 10)]; |
@@ -146,5 +146,5 @@ "use strict"; | ||
var getZodiac = function (earthlyBranchOfYear) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchOfYear); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchOfYear, 'Earthly'); | ||
return (0, i18n_1.t)(data_1.ZODIAC[data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch)]); | ||
}; | ||
exports.getZodiac = getZodiac; |
@@ -65,3 +65,3 @@ "use strict"; | ||
var earthlyBranchNameOfYear = yearly[1]; | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchNameOfYear); | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchNameOfYear, 'Earthly'); | ||
// 获取命宫干支,需要通过命宫干支计算五行局 | ||
@@ -113,3 +113,3 @@ var _a = (0, astro_1.getSoulAndBody)(solarDateStr, timeIndex, fixLeap), heavenlyStemOfSoul = _a.heavenlyStemOfSoul, earthlyBranchOfSoul = _a.earthlyBranchOfSoul; | ||
var heavenlyStemNameOfYear = yearly[0], earthlyBranchNameOfYear = yearly[1]; | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchNameOfYear); | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchNameOfYear, 'Earthly'); | ||
// 博士12神的顺序 | ||
@@ -152,3 +152,3 @@ var stars = [ | ||
var jqStartIdx = -1; | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranchOfYear = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
if (['yinEarthly', 'wuEarthly', 'xuEarthly'].includes(earthlyBranchOfYear)) { | ||
@@ -155,0 +155,0 @@ jqStartIdx = (0, utils_1.fixEarthlyBranchIndex)('woo'); |
@@ -91,3 +91,3 @@ "use strict"; | ||
var maIndex = 0; // 天马索引 | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
@@ -175,3 +175,3 @@ switch (earthlyBranch) { | ||
var yueIndex = -1; | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
switch (heavenlyStem) { | ||
@@ -334,3 +334,3 @@ case 'jiaHeavenly': | ||
var fixedTimeIndex = (0, utils_1.fixIndex)(timeIndex); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
switch (earthlyBranch) { | ||
@@ -384,3 +384,3 @@ case 'yinEarthly': | ||
var getLuanXiIndex = function (earthlyBranchName) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
var hongluanIndex = (0, utils_1.fixIndex)((0, utils_1.fixEarthlyBranchIndex)('mao') - data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch)); | ||
@@ -406,3 +406,3 @@ var tianxiIndex = (0, utils_1.fixIndex)(hongluanIndex + 6); | ||
var xcIdx = -1; | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
switch (earthlyBranch) { | ||
@@ -457,3 +457,3 @@ case 'yinEarthly': | ||
var guaIdx = -1; | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
switch (earthlyBranch) { | ||
@@ -536,4 +536,4 @@ case 'yinEarthly': | ||
var _a = (0, astro_1.getSoulAndBody)(solarDate, timeIndex, fixLeap), soulIndex = _a.soulIndex, bodyIndex = _a.bodyIndex; | ||
var heavenlyStem = (0, i18n_1.kot)(yearly[0]); | ||
var earthlyBranch = (0, i18n_1.kot)(yearly[1]); | ||
var heavenlyStem = (0, i18n_1.kot)(yearly[0], 'Heavenly'); | ||
var earthlyBranch = (0, i18n_1.kot)(yearly[1], 'Earthly'); | ||
var _b = (0, exports.getHuagaiXianchiIndex)(yearly[1]), huagaiIndex = _b.huagaiIndex, xianchiIndex = _b.xianchiIndex; | ||
@@ -597,3 +597,3 @@ var _c = (0, exports.getGuGuaIndex)(yearly[1]), guchenIndex = _c.guchenIndex, guasuIndex = _c.guasuIndex; | ||
var getNianjieIndex = function (earthlyBranchName) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
return (0, utils_1.fixIndex)((0, utils_1.fixEarthlyBranchIndex)(['xu', 'you', 'shen', 'wei', 'woo', 'si', 'chen', 'mao', 'yin', 'chou', 'zi', 'hai'][data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch)])); | ||
@@ -658,3 +658,3 @@ }; | ||
var quIndex = -1; | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
switch (heavenlyStem) { | ||
@@ -661,0 +661,0 @@ case 'jiaHeavenly': |
@@ -8,3 +8,3 @@ import { Brightness, EarthlyBranchName, HeavenlyStemName, Mutagen, StarName } from '../i18n'; | ||
* @param max 最大循环数,默认为12【因为12用得最多,宫位数量以及十二地支数量都为12,所以将12作为默认值】 | ||
* @returns 处理后的索引 | ||
* @returns {number} 处理后的索引 | ||
*/ | ||
@@ -15,4 +15,4 @@ export declare const fixIndex: (index: number, max?: number) => number; | ||
* | ||
* @param earthlyBranch 地支 | ||
* @returns 该地支对应的宫位索引序号 | ||
* @param {EarthlyBranchName} earthlyBranch 地支 | ||
* @returns {number} 该地支对应的宫位索引序号 | ||
*/ | ||
@@ -23,4 +23,4 @@ export declare const earthlyBranchIndexToPalaceIndex: (earthlyBranchName: EarthlyBranchName) => number; | ||
* | ||
* @param starName 星耀名字 | ||
* @param index 所在宫位索引 | ||
* @param {StarName} starName 星耀名字 | ||
* @param {number} index 所在宫位索引 | ||
*/ | ||
@@ -33,4 +33,4 @@ export declare const getBrightness: (starName: StarName, index: number) => Brightness; | ||
* | ||
* @param earthlyBranch 地支 | ||
* @returns Number(0~11) | ||
* @param {EarthlyBranchName} earthlyBranch 地支 | ||
* @returns {number} Number(0~11) | ||
*/ | ||
@@ -41,5 +41,5 @@ export declare const fixEarthlyBranchIndex: (earthlyBranchName: EarthlyBranchName) => number; | ||
* | ||
* @param solarDateStr 阳历日期 | ||
* @param timeIndex 时辰序号【0~12】,12代表晚子时 | ||
* @returns LunarDate | ||
* @param {string} solarDateStr 阳历日期 | ||
* @param {number} numbertimeIndex 时辰序号【0~12】,12代表晚子时 | ||
* @returns {LunarDate} LunarDate | ||
*/ | ||
@@ -55,5 +55,5 @@ export declare const fixLunarDate: (solarDateStr: string, timeIndex: number) => import("../data/types").LunarDate; | ||
* | ||
* @param solarDateStr 阳历日期 | ||
* @param timeIndex 时辰序号 | ||
* @param fixLeap 是否调整闰月 | ||
* @param {string} solarDateStr 阳历日期 | ||
* @param {number} timeIndex 时辰序号 | ||
* @param {vboolean} fixLeap 是否调整闰月 | ||
* @returns {number} 月份索引 | ||
@@ -66,4 +66,4 @@ */ | ||
* | ||
* @param stars 星耀数组 | ||
* @returns 合并后的星耀 | ||
* @param {Star[][][]} stars 星耀数组 | ||
* @returns {Star[][]} 合并后的星耀 | ||
*/ | ||
@@ -74,4 +74,4 @@ export declare const mergeStars: (...stars: Star[][][]) => Star[][]; | ||
* | ||
* @param hour 当前时间的小时数 | ||
* @returns 时辰的索引 | ||
* @param {number} hour 当前时间的小时数 | ||
* @returns {number} 时辰的索引 | ||
*/ | ||
@@ -86,5 +86,5 @@ export declare const timeToIndex: (hour: number) => number; | ||
* | ||
* @param earthlyBranchName 地支 | ||
* @returns 小限开始的宫位索引 | ||
* @param {EarthlyBranchName} earthlyBranchName 地支 | ||
* @returns {number} 小限开始的宫位索引 | ||
*/ | ||
export declare const getAgeIndex: (earthlyBranchName: EarthlyBranchName) => number; |
@@ -17,3 +17,3 @@ "use strict"; | ||
* @param max 最大循环数,默认为12【因为12用得最多,宫位数量以及十二地支数量都为12,所以将12作为默认值】 | ||
* @returns 处理后的索引 | ||
* @returns {number} 处理后的索引 | ||
*/ | ||
@@ -35,8 +35,8 @@ var fixIndex = function (index, max) { | ||
* | ||
* @param earthlyBranch 地支 | ||
* @returns 该地支对应的宫位索引序号 | ||
* @param {EarthlyBranchName} earthlyBranch 地支 | ||
* @returns {number} 该地支对应的宫位索引序号 | ||
*/ | ||
var earthlyBranchIndexToPalaceIndex = function (earthlyBranchName) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var yin = (0, i18n_1.kot)('yinEarthly'); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
var yin = (0, i18n_1.kot)('yinEarthly', 'Earthly'); | ||
return (0, exports.fixIndex)(data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch) - data_1.EARTHLY_BRANCHES.indexOf(yin)); | ||
@@ -48,4 +48,4 @@ }; | ||
* | ||
* @param starName 星耀名字 | ||
* @param index 所在宫位索引 | ||
* @param {StarName} starName 星耀名字 | ||
* @param {number} index 所在宫位索引 | ||
*/ | ||
@@ -59,3 +59,3 @@ var getBrightness = function (starName, index) { | ||
var getMutagen = function (starName, heavenlyStemName) { | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
var starKey = (0, i18n_1.kot)(starName); | ||
@@ -66,3 +66,3 @@ return (0, i18n_1.t)(data_1.MUTAGEN[data_1.heavenlyStems[heavenlyStem].mutagen.indexOf(starKey)]); | ||
var getMutagensByHeavenlyStem = function (heavenlyStemName) { | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName); | ||
var heavenlyStem = (0, i18n_1.kot)(heavenlyStemName, 'Heavenly'); | ||
return data_1.heavenlyStems[heavenlyStem].mutagen.map(function (star) { return (0, i18n_1.t)(star); }); | ||
@@ -74,7 +74,7 @@ }; | ||
* | ||
* @param earthlyBranch 地支 | ||
* @returns Number(0~11) | ||
* @param {EarthlyBranchName} earthlyBranch 地支 | ||
* @returns {number} Number(0~11) | ||
*/ | ||
var fixEarthlyBranchIndex = function (earthlyBranchName) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
return (0, exports.fixIndex)(data_1.EARTHLY_BRANCHES.indexOf(earthlyBranch) - data_1.EARTHLY_BRANCHES.indexOf('yinEarthly')); | ||
@@ -86,5 +86,5 @@ }; | ||
* | ||
* @param solarDateStr 阳历日期 | ||
* @param timeIndex 时辰序号【0~12】,12代表晚子时 | ||
* @returns LunarDate | ||
* @param {string} solarDateStr 阳历日期 | ||
* @param {number} numbertimeIndex 时辰序号【0~12】,12代表晚子时 | ||
* @returns {LunarDate} LunarDate | ||
*/ | ||
@@ -112,5 +112,5 @@ var fixLunarDate = function (solarDateStr, timeIndex) { | ||
* | ||
* @param solarDateStr 阳历日期 | ||
* @param timeIndex 时辰序号 | ||
* @param fixLeap 是否调整闰月 | ||
* @param {string} solarDateStr 阳历日期 | ||
* @param {number} timeIndex 时辰序号 | ||
* @param {vboolean} fixLeap 是否调整闰月 | ||
* @returns {number} 月份索引 | ||
@@ -131,4 +131,4 @@ */ | ||
* | ||
* @param stars 星耀数组 | ||
* @returns 合并后的星耀 | ||
* @param {Star[][][]} stars 星耀数组 | ||
* @returns {Star[][]} 合并后的星耀 | ||
*/ | ||
@@ -152,4 +152,4 @@ var mergeStars = function () { | ||
* | ||
* @param hour 当前时间的小时数 | ||
* @returns 时辰的索引 | ||
* @param {number} hour 当前时间的小时数 | ||
* @returns {number} 时辰的索引 | ||
*/ | ||
@@ -175,7 +175,7 @@ var timeToIndex = function (hour) { | ||
* | ||
* @param earthlyBranchName 地支 | ||
* @returns 小限开始的宫位索引 | ||
* @param {EarthlyBranchName} earthlyBranchName 地支 | ||
* @returns {number} 小限开始的宫位索引 | ||
*/ | ||
var getAgeIndex = function (earthlyBranchName) { | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName); | ||
var earthlyBranch = (0, i18n_1.kot)(earthlyBranchName, 'Earthly'); | ||
var ageIdx = -1; | ||
@@ -182,0 +182,0 @@ if (['yinEarthly', 'wuEarthly', 'xuEarthly'].includes(earthlyBranch)) { |
{ | ||
"name": "iztro", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"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", |
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
452616