Add JSdoc for the API

This commit is contained in:
Oliver-Akins 2025-03-12 22:40:19 -06:00
parent fd28993952
commit 96ef2ba56f

View file

@ -1,5 +1,12 @@
import { gameTerms } from "../gameTerms.mjs"; import { gameTerms } from "../gameTerms.mjs";
/**
* Converts a rank's name into an integer form for use in mathematical calculations
* that rely on rank.
*
* @param {Novice|Adept|Expert|Master} rankName The rank to convert into an integer
* @returns An integer between 1 and 4
*/
export function rankToInteger(rankName) { export function rankToInteger(rankName) {
return Object.values(gameTerms.Rank) return Object.values(gameTerms.Rank)
.findIndex(r => r === rankName) + 1; .findIndex(r => r === rankName) + 1;