Update CalculateLuckyLevels.js (#1217)

* Update CalculateLuckyLevels.js

Fixed infinite loop when currentLevel is too big

* Update CalculateLuckyLevels.js Dev build

* Update CalculateLuckyLevels.js Final build
This commit is contained in:
WiseDragoon
2025-03-16 16:43:05 -03:00
committed by GitHub
parent 69b923de89
commit bd772e3712
5 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@ export function CalculateSevenDelta(number, digitPlace) {
export default function CalculateLuckyLevels(currentLevel) { export default function CalculateLuckyLevels(currentLevel) {
const result = {}; const result = {};
let sevenCount = CountSevens(currentLevel); let sevenCount = CountSevens(currentLevel);
const numberOfDigits = String(currentLevel).length; const numberOfDigits = Math.max(Math.floor(Math.log10(Math.abs(currentLevel))), 0) + 1;
if (sevenCount >= 1) { if (sevenCount >= 1) {
result.luckyDigit = currentLevel; result.luckyDigit = currentLevel;