Add a customizable weight formatter function

This commit is contained in:
Oliver 2026-03-23 00:22:54 -06:00
parent 6e2dfa1cf1
commit 44372d0a17
3 changed files with 23 additions and 7 deletions

View file

@ -0,0 +1,12 @@
import { __ID__ } from "../consts.mjs";
import { toPrecision } from "./roundToPrecision.mjs";
/**
* Formats a numerical value as a weight.
*
* @param {number} weight The numerical weight to format
*/
export function formatWeight(weight) {
const unit = game.settings.get(__ID__, `weightUnit`);
return toPrecision(weight, 2) + unit;
};