format-money-js
Advanced tools
Comparing version 1.1.0 to 1.1.2
/*! | ||
* format-money-js v1.1.0 | ||
* format-money-js v1.1.2 | ||
* (c) 2020 Yurii Derevych | ||
@@ -4,0 +4,0 @@ * Released under the BSD-2-Clause License. |
"use strict"; | ||
/*! | ||
* format-money-js v1.1.0 | ||
* format-money-js v1.1.2 | ||
* (c) 2020 Yurii Derevych | ||
@@ -11,3 +11,3 @@ * Released under the BSD-2-Clause License. | ||
this.options = options; | ||
this.version = '1.1.0'; | ||
this.version = '1.1.2'; | ||
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.0",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.2",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 (484 bytes) by CurrencyRate.today, providing simple and advanced number, money and currency formatting.", | ||
"version": "1.1.0", | ||
"description": "Tiny JavaScript library (656 bytes) by CurrencyRate.today, providing simple and advanced number, money and currency formatting.", | ||
"version": "1.1.2", | ||
"license": "BSD-2-Clause", | ||
@@ -6,0 +6,0 @@ "main": "./dist/format-money.js", |
# format-money-js | ||
[![Build Status](https://travis-ci.org/dejurin/format-money-js.svg?branch=master)](https://travis-ci.org/dejurin/format-money-js) | ||
Tiny JavaScript library (484 bytes) by CurrencyRate.today, providing simple and advanced number, money and currency formatting. | ||
Tiny JavaScript library (656 bytes) by CurrencyRate.today, providing simple and advanced number, money and currency formatting. | ||
@@ -9,9 +9,9 @@ ## Example | ||
``` | ||
const { FormatMoney } = require('./dist/format-money.js'); | ||
const { FormatMoney } = require('format-money-js'); | ||
const fm = FormatMoney(12345.67, { | ||
decimals: 2, | ||
prefix: '$' | ||
const fm = new FormatMoney({ | ||
decimals: 2 | ||
}); | ||
console.log(fm); // $12,345.67 | ||
console.log(fm.from(12345.67, { prefix: '$' })); // $12,345.67 | ||
``` |
/*! | ||
* format-money-js v1.1.0 | ||
* format-money-js v1.1.2 | ||
* (c) 2020 Yurii Derevych | ||
@@ -18,3 +18,3 @@ * Released under the BSD-2-Clause License. | ||
version = '1.1.0'; | ||
version = '1.1.2'; | ||
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
13093