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

    Function formatNumber

    • Format a number, with comma-separated thousands and custom precision/decimal places.

      Usage:

      // Default usage
      formatNumber(5318008);
      // => 5,318,008

      // Custom format
      formatNumber(9876543.21, { precision: 3, thousand: " " });
      // => 9 876 543.210

      Parameters

      • number: number

        Number to be formatted

      • Optionalopts: Settings = {}

        Object containing all the options of the method

      Returns string

      • Given number properly formatted