Begin implementation of the Stats / Skills tab

This commit is contained in:
Oliver-Akins 2024-02-29 22:35:28 -07:00
parent 753d72b4e0
commit 0e8d1615a7
16 changed files with 292 additions and 64 deletions

View file

@ -0,0 +1,18 @@
/**
* Takes in an integer and converts it into a string format that can be used in
* roll formulas or for displaying to the user.
*
* @param {number} mod The modifier to stringify
* @param {object} opts
* @param {boolean} opts.spaces Puts spaces on either side of the operand
* @returns {string}
*/
export function modifierToString(mod, opts = {}) {
if (mod == 0) return ``;
let value = [``, `+`, mod]
if (mod < 0) {
value = [``, `-`, Math.abs(mod)]
};
return value.join(opts.spaces ? ` ` : ``);
};