format-money-js
Advanced tools
Comparing version 1.4.3 to 1.4.4
/*! | ||
* format-money-js v1.4.3 | ||
* (c) 2020 Yurii Derevych | ||
* format-money-js v1.4.4 | ||
* (c) 2020-2022 Yurii Derevych | ||
* Sponsored by https://currencyrate.today/ | ||
* Released under the BSD-2-Clause License. | ||
@@ -5,0 +6,0 @@ */ |
"use strict"; | ||
/*! | ||
* format-money-js v1.4.3 | ||
* (c) 2020 Yurii Derevych | ||
* format-money-js v1.4.4 | ||
* (c) 2020-2022 Yurii Derevych | ||
* Sponsored by https://currencyrate.today/ | ||
* Released under the BSD-2-Clause License. | ||
@@ -12,3 +13,3 @@ */ | ||
this.options = options; | ||
this.version = '1.3.3'; | ||
this.version = '1.4.4'; | ||
this.defaults = { | ||
@@ -15,0 +16,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.3",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1},this.from=((t,e,s=!1)=>{const o=Object.assign(Object.assign({},this.options),e);if("number"!=typeof t)return;const i=t<0?"-":"";let n,r,a,l,c,p,m;if(n=Math.abs(t).toFixed(o.decimals),a=(r=(n+="").split("."))[0],l=r.length>1?o.decimalPoint+r[1]:"",o.grouping){c="";for(let t=0,e=a.length;t<e;t+=1)0!==t&&t%3==0&&(c=o.separator+c),c=a[e-t-1]+c;a=c}return p=m="",o.append?m=o.symbol:p=o.symbol,s?{source:t,negative:t<0,fullAmount:a+l,amount:a,decimals:l,symbol:o.symbol}:i+p+a+l+m}),this.un=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e);if("number"==typeof t)return t;if("string"!=typeof t)return;const o=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),i=parseFloat(t.replace(/\((?=\d+)(.*)\)/,"-$1").replace(o,"").replace(`${s.decimalPoint}`,"."));return isNaN(i)?0:i}),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.4.4",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1},this.from=((t,e,s=!1)=>{const o=Object.assign(Object.assign({},this.options),e);if("number"!=typeof t)return;const i=t<0?"-":"";let n,r,a,l,c,p,m;if(n=Math.abs(t).toFixed(o.decimals),a=(r=(n+="").split("."))[0],l=r.length>1?o.decimalPoint+r[1]:"",o.grouping){c="";for(let t=0,e=a.length;t<e;t+=1)0!==t&&t%3==0&&(c=o.separator+c),c=a[e-t-1]+c;a=c}return p=m="",o.append?m=o.symbol:p=o.symbol,s?{source:t,negative:t<0,fullAmount:a+l,amount:a,decimals:l,symbol:o.symbol}:i+p+a+l+m}),this.un=((t,e)=>{const s=Object.assign(Object.assign({},this.options),e);if("number"==typeof t)return t;if("string"!=typeof t)return;const o=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),i=parseFloat(t.replace(/\((?=\d+)(.*)\)/,"-$1").replace(o,"").replace(`${s.decimalPoint}`,"."));return isNaN(i)?0:i}),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.4.3", | ||
"version": "1.4.4", | ||
"license": "BSD-2-Clause", | ||
@@ -6,0 +6,0 @@ "main": "./dist/format-money.js", |
@@ -79,1 +79,5 @@ # format-money-js | ||
https://fx-w.io/ | ||
https://moneyconvert.net/ | ||
https://cr.today/ |
/*! | ||
* format-money-js v1.4.3 | ||
* (c) 2020 Yurii Derevych | ||
* format-money-js v1.4.4 | ||
* (c) 2020-2022 Yurii Derevych | ||
* Sponsored by https://currencyrate.today/ | ||
* Released under the BSD-2-Clause License. | ||
@@ -27,3 +28,3 @@ */ | ||
version = '1.3.3'; | ||
version = '1.4.4'; | ||
private defaults: FormatMoneyOptions = { | ||
@@ -30,0 +31,0 @@ grouping: true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21564
17
383
83