💸 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 toward the Browser or Node versions. Unlike Number.prototype.toLocaleString, pretty-money produces the same code in every environment.

  • Small. Dependency free. 471 bytes are 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.

Check Here – Lightweight Vue Currency Filter Based On accounting.js

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

Read More – 

Currency Mask Module for Angular Library | ngx-currency
Simple Custom Directive To Handle Currency Formatting Within Text Inputs


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.

Share