Pathfinder 1e for Foundry VTT
    Preparing search index...

    Function format

    • Experimental

      Format currency into human readable string

      Parameters

      • currency: Record<"gp" | "cp" | "pp" | "sp", number>
      • Optionaloptions: { pad?: boolean } = {}
        • Optionalpad?: boolean

          Add padding result if there's no currencies, by default "0 gp".

      Returns string

      pf1.utils.currency.format({gp: 0.15}); // => "1 sp, 5 cp"
      pf1.utils.currency.format({cp: 1500}); // => "15 gp"
      pf1.utils.currency.format({pp: 2, gp: 20, cp: 33}); // => "40 gp, 3 sp, 3 cp"
      pf1.utils.currency.format({pp: 0}); // => "0 gp"
      pf1.utils.currency.format({gp: 0}, {pad:false}); // => ""