format-money-js
Advanced tools
Comparing version 1.3.2 to 1.3.3
/*! | ||
* format-money-js v1.3.2 | ||
* format-money-js v1.3.3 | ||
* (c) 2020 Yurii Derevych | ||
@@ -4,0 +4,0 @@ * Released under the BSD-2-Clause License. |
"use strict"; | ||
/*! | ||
* format-money-js v1.3.2 | ||
* format-money-js v1.3.3 | ||
* (c) 2020 Yurii Derevych | ||
@@ -12,3 +12,3 @@ * Released under the BSD-2-Clause License. | ||
this.options = options; | ||
this.version = '1.3.2'; | ||
this.version = '1.3.3'; | ||
this.defaults = { | ||
@@ -15,0 +15,0 @@ grouping: true, |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FormatMoney=void 0;class FormatMoney{constructor(t){this.options=t,this.version="1.3.2",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1},this.from=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e);if("string"==typeof t)return t;const o=t<0?"-":"";let i,n,r,a,c,p,l;if(i=Math.abs(t).toFixed(s.decimals),r=(n=(i+="").split("."))[0],a=n.length>1?s.decimalPoint+n[1]:"",s.grouping){c="";for(let t=0,e=r.length;t<e;t+=1)0!==t&&t%3==0&&(c=s.separator+c),c=r[e-t-1]+c;r=c}return p=l="",s.append?l=s.symbol:p=s.symbol,o+p+r+a+l}),this.un=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e),o=t||0;if("number"==typeof o)return o;const i=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),n=parseFloat(o.replace(/\((?=\d+)(.*)\)/,"-$1").replace(i,"").replace(s.decimalPoint,"."));return isNaN(n)?0:n}),this.options=Object.assign(Object.assign({},this.defaults),t)}}exports.FormatMoney=FormatMoney; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FormatMoney=void 0;class FormatMoney{constructor(t){this.options=t,this.version="1.3.3",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1},this.from=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e);if("string"==typeof t)return t;const o=t<0?"-":"";let i,n,r,a,c,p,l;if(i=Math.abs(t).toFixed(s.decimals),r=(n=(i+="").split("."))[0],a=n.length>1?s.decimalPoint+n[1]:"",s.grouping){c="";for(let t=0,e=r.length;t<e;t+=1)0!==t&&t%3==0&&(c=s.separator+c),c=r[e-t-1]+c;r=c}return p=l="",s.append?l=s.symbol:p=s.symbol,o+p+r+a+l}),this.un=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e),o=t||0;if("number"==typeof o)return o;const i=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),n=parseFloat(o.replace(/\((?=\d+)(.*)\)/,"-$1").replace(i,"").replace(s.decimalPoint,"."));return isNaN(n)?0:n}),this.options=Object.assign(Object.assign({},this.defaults),t)}}exports.FormatMoney=FormatMoney; |
{ | ||
"name": "format-money-js", | ||
"description": "Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"license": "BSD-2-Clause", | ||
@@ -6,0 +6,0 @@ "main": "./dist/format-money.js", |
/*! | ||
* format-money-js v1.3.2 | ||
* format-money-js v1.3.3 | ||
* (c) 2020 Yurii Derevych | ||
@@ -18,3 +18,3 @@ * Released under the BSD-2-Clause License. | ||
version = '1.3.2'; | ||
version = '1.3.3'; | ||
private defaults: FormatMoneyOptions = { | ||
@@ -21,0 +21,0 @@ grouping: true, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package