Comparing version 1.1.7 to 1.1.8
@@ -140,3 +140,6 @@ "use strict"; | ||
var mask = exports.MASKS.currency.textMask(vals[0]); | ||
var decimals = vals.length > 1 ? vals[1] : '00'; | ||
var decimals = vals.length > 1 ? vals[1] + '' : '00'; | ||
if (decimals.length > 2) { | ||
decimals = decimals.substring(0, 2); | ||
} | ||
return conformToMask(currencyValue, mask, { guide: false }).conformedValue + ',' + decimals; | ||
@@ -143,0 +146,0 @@ }, |
@@ -80,2 +80,3 @@ "use strict"; | ||
var currencyNumberNoDecimals = 5103; | ||
var currencyNumberMany = 5103.9423234; | ||
chai_1.expect(index_1.maskBr.currency(currencyNoDecimals)).to.be.equal('R$ 5.103,00'); | ||
@@ -87,2 +88,3 @@ chai_1.expect(index_1.maskBr.currency(currencyTextNoDecimals)).to.be.equal('R$ 5.103,00'); | ||
chai_1.expect(index_1.maskBr.currency(currencyText)).to.be.equal('R$ 5.103,94'); | ||
chai_1.expect(index_1.maskBr.currency(currencyNumberMany)).to.be.equal('R$ 5.103,94'); | ||
}); | ||
@@ -89,0 +91,0 @@ // // it('Time', () => { |
{ | ||
"name": "js-brasil", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Javascript Utils para Brasil (cpf, cnpj...)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -150,3 +150,6 @@ import { isArray, processCaretTraps } from './utils'; | ||
const mask = MASKS.currency.textMask(vals[0]); | ||
const decimals = vals.length > 1 ? vals[1] : '00'; | ||
let decimals = vals.length > 1 ? vals[1] + '' : '00'; | ||
if (decimals.length > 2) { | ||
decimals = decimals.substring(0, 2); | ||
} | ||
@@ -153,0 +156,0 @@ return conformToMask( |
@@ -85,2 +85,3 @@ import { maskBr, fakerBr, validateBr } from '../index'; | ||
const currencyNumberNoDecimals = 5103; | ||
const currencyNumberMany = 5103.9423234; | ||
@@ -94,2 +95,3 @@ expect(maskBr.currency(currencyNoDecimals)).to.be.equal('R$ 5.103,00'); | ||
expect(maskBr.currency(currencyText)).to.be.equal('R$ 5.103,94'); | ||
expect(maskBr.currency(currencyNumberMany)).to.be.equal('R$ 5.103,94'); | ||
}); | ||
@@ -96,0 +98,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
691428
11719