Comparing version
@@ -73,6 +73,8 @@ "use strict"; | ||
function currencyToNumber(input) { | ||
var vals = input.split(' '); | ||
if (vals.length === 2) { | ||
input = input.replace(/ /g, ''); | ||
if (input.indexOf('$') !== -1) { | ||
var vals = input.split('$'); | ||
input = vals[1]; | ||
} | ||
input = input.replace('%', ''); | ||
input = input.replace(/\./g, '').replace(',', '.'); | ||
@@ -79,0 +81,0 @@ return parseFloat(input); |
{ | ||
"name": "js-brasil", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "Javascript Utils para Brasil (cpf, cnpj...)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -76,8 +76,12 @@ export function isPresent(obj: any): boolean { | ||
export function currencyToNumber(input){ | ||
const vals = input.split(' '); | ||
if(vals.length===2){ | ||
input = input.replace(/ /g,''); | ||
if(input.indexOf('$')!==-1){ | ||
const vals = input.split('$'); | ||
input = vals[1]; | ||
} | ||
input = input.replace('%',''); | ||
input = input.replace(/\./g,'').replace(',','.'); | ||
return parseFloat(input); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
853811
0.27%79
3.95%14374
0.24%