accounting-js - v2.0.3
    Preparing search index...

    Function formatMoney

    • Format a number into currency.

      Usage:

      // Default usage
      formatMoney(12345678);
      // => $12,345,678.00

      // European formatting (custom symbol and separators)
      formatMoney(4999.99, { symbol: "€", precision: 2, thousand: ".", decimal: "," });
      // => €4.999,99

      // Negative values can be formatted nicely
      formatMoney(-500000, { symbol: "£ ", precision: 0 });
      // => £ -500,000

      // Simple `format` string allows control of symbol position (%v = value, %s = symbol)
      formatMoney(5318008, { symbol: "GBP", format: "%v %s" });
      // => 5,318,008.00 GBP

      Parameters

      • amount: number

        Amount to be formatted

      • Optionalopts: Settings = {}

        Object containing all the options of the method

      Returns string

      • Given number properly formatted as money