Add type checking and JSDoc comments to some utils

This commit is contained in:
Cohee
2023-08-22 13:07:24 +03:00
parent 2615eb8532
commit e2bac7ec5f
10 changed files with 409 additions and 138 deletions

View File

@ -25,13 +25,12 @@ function createStatBlock(statName, statValue) {
* @returns {number} - The stat value if it is a number, otherwise 0.
*/
function verifyStatValue(stat) {
return isNaN(stat) ? 0 : stat;
return isNaN(Number(stat)) ? 0 : Number(stat);
}
/**
* Calculates total stats from character statistics.
*
* @param {Object} charStats - Object containing character statistics.
* @returns {Object} - Object containing total statistics.
*/
function calculateTotalStats() {