format-money-js
Advanced tools
Comparing version 1.1.5 to 1.1.6
/*! | ||
* format-money-js v1.1.5 | ||
* format-money-js v1.1.6 | ||
* (c) 2020 Yurii Derevych | ||
@@ -4,0 +4,0 @@ * Released under the BSD-2-Clause License. |
"use strict"; | ||
/*! | ||
* format-money-js v1.1.5 | ||
* format-money-js v1.1.6 | ||
* (c) 2020 Yurii Derevych | ||
@@ -11,3 +11,3 @@ * Released under the BSD-2-Clause License. | ||
this.options = options; | ||
this.version = '1.1.5'; | ||
this.version = '1.1.6'; | ||
this.defaults = { | ||
@@ -14,0 +14,0 @@ grouping: true, |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class FormatMoney{constructor(t){this.options=t,this.version="1.1.5",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,prefix:"",suffix:""},this.from=((t,s)=>{s=Object.assign(Object.assign({},this.options),s);const e=t<0?"-":"";let i,o,r,a,n;if(i=Math.abs(t).toFixed(s.decimals),r=(o=(i+="").split("."))[0],a=o.length>1?s.decimalPoint+o[1]:"",s.grouping){n="";for(let t=0,e=r.length;t<e;++t)0!==t&&t%3==0&&(n=s.separator+n),n=r[e-t-1]+n;r=n}return e+s.prefix+r+a+s.suffix}),this.options=Object.assign(Object.assign({},this.defaults),t)}}exports.FormatMoney=FormatMoney; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class FormatMoney{constructor(t){this.options=t,this.version="1.1.6",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,prefix:"",suffix:""},this.from=((t,s)=>{s=Object.assign(Object.assign({},this.options),s);const e=t<0?"-":"";let i,o,r,a,n;if(i=Math.abs(t).toFixed(s.decimals),r=(o=(i+="").split("."))[0],a=o.length>1?s.decimalPoint+o[1]:"",s.grouping){n="";for(let t=0,e=r.length;t<e;++t)0!==t&&t%3==0&&(n=s.separator+n),n=r[e-t-1]+n;r=n}return e+s.prefix+r+a+s.suffix}),this.options=Object.assign(Object.assign({},this.defaults),t)}}exports.FormatMoney=FormatMoney; |
{ | ||
"name": "format-money-js", | ||
"description": "Tiny JavaScript library (656 bytes) by CurrencyRate.today, providing simple and advanced number, money and currency formatting.", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"license": "BSD-2-Clause", | ||
@@ -6,0 +6,0 @@ "main": "./dist/format-money.js", |
@@ -23,2 +23,10 @@ # format-money-js | ||
You can added options in construct of class and in method. But method will be primary. | ||
### Example: | ||
``` | ||
const fm = new FormatMoney({ prefix: '$' }); | ||
console.log(fm.from(12345.67, { prefix: '€' })); // €12,345.67 | ||
``` | ||
| Name | Default | Type | Example | ||
@@ -33,12 +41,4 @@ |---------------|----------|---------|------------------------------| | ||
You can added options in construct of class and in method. But method will be primary. | ||
### Example: | ||
``` | ||
const fm = new FormatMoney({ prefix: '$' }); | ||
## Source | ||
console.log(fm.from(12345.67, { prefix: '€' })); // €12,345.67 | ||
``` | ||
## Thank you | ||
https://currencyrate.today/ |
/*! | ||
* format-money-js v1.1.5 | ||
* format-money-js v1.1.6 | ||
* (c) 2020 Yurii Derevych | ||
@@ -18,3 +18,3 @@ * Released under the BSD-2-Clause License. | ||
version = '1.1.5'; | ||
version = '1.1.6'; | ||
private defaults: FormatMoneyOptions = { | ||
@@ -21,0 +21,0 @@ grouping: true, |
14203