Comparing version 1.3.1 to 1.3.2
@@ -10,2 +10,14 @@ # 紫微斗数 @sylarlong/astro | ||
## v1.3.2 | ||
- 🪄 功能(feature) | ||
🇨🇳 | ||
- 判断指定运限宫位内是否不包含指定流耀 #67 | ||
🇺🇸 | ||
- check if horoscope stars are not in specific palace #67 | ||
## v1.3.1 | ||
@@ -21,3 +33,3 @@ | ||
- heavenly stem and earthly branch translation issue #31 | ||
- heavenly stem and earthly branch translation issue #64 | ||
@@ -24,0 +36,0 @@ ## v1.3.0 |
@@ -42,6 +42,17 @@ import { Horoscope, Scope } from '../data/types'; | ||
* @param scope 指定获取哪个运限的宫位 | ||
* @param horoscopeStar | ||
* @param horoscopeStar 流耀 | ||
* @returns {boolean} 是否包含指定流耀 | ||
*/ | ||
hasHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean; | ||
/** | ||
* 判断指定运限宫位内是否不含流耀,需要全部不包含才返回true | ||
* | ||
* @version v1.3.2 | ||
* | ||
* @param palaceName 宫位名称 | ||
* @param scope 指定获取哪个运限的宫位 | ||
* @param horoscope 流耀 | ||
* @returns {boolean} 是否不含指定流耀 | ||
*/ | ||
notHaveHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscope: StarName[]) => boolean; | ||
} | ||
@@ -72,2 +83,3 @@ export default class FunctionalHoroscope implements IFunctionalHoroscope { | ||
hasHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean; | ||
notHaveHoroscopeStars: (palaceName: PalaceName, scope: Scope, horoscopeStar: StarName[]) => boolean; | ||
} |
@@ -5,2 +5,18 @@ "use strict"; | ||
var utils_1 = require("../utils"); | ||
var _getHoroscopePalaceIndex = function ($, scope, palaceName) { | ||
var palaceIndex = -1; | ||
if (scope === 'origin') { | ||
$.astrolabe.palaces.some(function (p, idx) { | ||
if (p.name === palaceName) { | ||
palaceIndex = idx; | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
else { | ||
palaceIndex = $[scope].palaceNames.indexOf(palaceName); | ||
} | ||
return palaceIndex; | ||
}; | ||
var FunctionalHoroscope = /** @class */ (function () { | ||
@@ -27,18 +43,6 @@ function FunctionalHoroscope(data, astrolabe) { | ||
this.hasHoroscopeStars = function (palaceName, scope, horoscopeStar) { | ||
var palaceIndex = -1; | ||
if (!_this.decadal.stars || !_this.yearly.stars) { | ||
return false; | ||
} | ||
if (scope === 'origin') { | ||
_this.astrolabe.palaces.some(function (p, idx) { | ||
if (p.name === palaceName) { | ||
palaceIndex = idx; | ||
return true; | ||
} | ||
return false; | ||
}); | ||
} | ||
else { | ||
palaceIndex = _this[scope].palaceNames.indexOf(palaceName); | ||
} | ||
var palaceIndex = _getHoroscopePalaceIndex(_this, scope, palaceName); | ||
var stars = (0, utils_1.mergeStars)(_this.decadal.stars, _this.yearly.stars)[palaceIndex]; | ||
@@ -49,2 +53,12 @@ var starKeys = stars.map(function (item) { return (0, i18n_1.kot)(item.name); }); | ||
}; | ||
this.notHaveHoroscopeStars = function (palaceName, scope, horoscopeStar) { | ||
if (!_this.decadal.stars || !_this.yearly.stars) { | ||
return false; | ||
} | ||
var palaceIndex = _getHoroscopePalaceIndex(_this, scope, palaceName); | ||
var stars = (0, utils_1.mergeStars)(_this.decadal.stars, _this.yearly.stars)[palaceIndex]; | ||
var starKeys = stars.map(function (item) { return (0, i18n_1.kot)(item.name); }); | ||
var horoscopeStarKeys = horoscopeStar.map(function (item) { return (0, i18n_1.kot)(item); }); | ||
return horoscopeStarKeys.every(function (star) { return !starKeys.includes(star); }); | ||
}; | ||
this.lunarDate = data.lunarDate; | ||
@@ -51,0 +65,0 @@ this.solarDate = data.solarDate; |
{ | ||
"name": "iztro", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"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", |
@@ -66,3 +66,5 @@ <div align="center"> | ||
- 获取指定星耀对宫 | ||
- 其他 | ||
@@ -85,2 +87,6 @@ | ||
``` | ||
> [!IMPORTANT] | ||
> 如果你在开发中遇到任何问题,可以添加作者微信咨询 | ||
> 你也可以任意魔改代码,或联系作者获取技术支持 | ||
> <img src="https://github.com/SylarLong/SylarLong/assets/6510425/a2af4876-7d26-4900-a0fc-f5a2030f6205" alt="WeChat" width="350" /> | ||
@@ -154,2 +160,5 @@ ### 快捷跳转 | ||
> [!IMPORTANT] | ||
> 如果你觉得代码对你有用,请点⭐支持,你的⭐是我持续更新的动力 | ||
### 总结 | ||
@@ -177,4 +186,5 @@ | ||
请合理使用本开源代码,禁止用于非法目的。 | ||
> [!NOTE] | ||
> 请合理使用本开源代码,禁止用于非法目的。 | ||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSylarLong%2Fiztro.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FSylarLong%2Fiztro?ref=badge_large) |
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
454499
12067
187