0.1.0 • Published 7 years ago

format-decimal v0.1.0

Weekly downloads
129
License
MIT
Repository
github
Last release
7 years ago

#format-decimal stable

Format thousands and decimals with custom separator: 1.000.000,00

Options

You can pass a configuration object as second parameter with the following keys:

  • decimal: Symbol to use for decimal point (default: ,).
  • precision: Number of decimal digits to show (default: 2).
  • thousands: Symbol to use for thousands separator (default: .).

Usage

npm install format-decimal

const formatDecimal = require('format-decimal');

console.log(formatDecimal(123456.789)); // 123.456,79
console.log(
    formatDecimal(
        123456.789,
        {
            decimal   : '.',
            precision : 1,
            thousands : ','
        }
    )
); // 123,456.8