Press "Enter" to skip to content

💸 A Tiny Currency Formatting Library For JavaScript | pretty-money

pretty-money is the currency format library for JavaScript and a convenient coin formatting tool used to format and beautify currency (money) and numbers with custom symbols, markers, and decimal places.

It can help you coordinate financial values in any way you want. Although highly customizable, Nice Money is easy to use and extremely lightweight (471-byte main compressor).

The pretty-money is free of dependency and not completely biased towards the Browser or Node versions. Unlike Number.prototype.toLocaleString, pretty-money produces the same code in every environment.

  • Small. Dependency free. 471 bytes is minimized and compressed. Controlled by the size limit.
  • functional. The job is processed automatically (think Ramda).
  • flexible. It can be modified to introduce any modern currency.

html format currency 00, js money, format currency jquery, npm currency formatter, currency filter in javascript

How to make use of it:

1. Install the package and import the pretty-money as a module.

# NPM
$ npm install pretty-money --save
import prettyMoney from "pretty-money";

2. Or instantly load the umd version of the library from a CDN.

<script src="https://cdn.jsdelivr.net/npm/pretty-money/dist/pretty-money.umd.js"></script>

3. Format a numerical value you present:

let price = prettyMoney({ 
    currency: "$" 
}, 10000); 

//=> "10000 $"

4. Set the place of the currency image.

let price = prettyMoney({ 
    currency: "$",
    position: "before"
}, 10000); 

//=> "$ 10000"

5. Customize the number of decimal places.

let price = prettyMoney({ 
    currency: "$",
    position: "before",
    decimals: "fixed"
}, 10000);

6. Customize the decimal and thousands of delimiters.

let price = prettyMoney({ 
    currency: "$",
    position: "before",
    decimals: "fixed",
    decimalDelimiter: ",",
    thousandsDelimiter: "."
}, 10000); 

//=> "$ 10.000,00"

7. Set the min/max variety of decimal places.

let price = prettyMoney({ 
    maxDecimal: 2,
    minDecimal: 0
}, 10000);

Easy Currency Formatter, pretty-money Plugin/Github, js pretty print number, html5 format currency, currency format in javascript


See Demo And Download

Official Website(NickKaramoff): Click Here

This superior jQuery/javascript plugin is developed by NickKaramoff. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.