Skip to content

joaquinfq/format-decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

Format thousands and decimal with custom separator: 1.000.000,00

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published