masked method work incorrectly with unmasked results
### Describe the bug
All inputs have activated number mask with local `pt-BR`. Last input calculate sum for all other inputs and have mask too:
```js
const mask = new Mask({ number: { locale: 'pt-BR', fraction: 2 } })
const totalAmount = Array.rom(document.querySelectorAll('.inputs')).reduce((agg, target) => {
const value = target.value ? parseFloat(mask.unmasked(target.value.toString())) : 0
return agg + (isNaN(value) ? 0 : value)
}, 0)
document.querySelector('.totalInput').value = totalAmount.toString()
document.querySelector('.totalInput').dispatchEvent(new Event('input', { bubbles: true })) // trigger mask.js
```
This lead that number incorrectly masked in total field. Instead of `10.34` it get `1034`. So this mean:
```js
mask.masked(mask.unmasked('10.234,54')) !== '10.234,54'
```
### Steps to reproduce
```js
const { Mask } = Maska;
const mask = new Mask({ number: { locale: 'pt-BR', fraction: 2 } })
console.log('correct', mask.unmasked('10.234,54')) // correct 10234.54
console.log('incorrect', mask.masked('10234.54')) // incorrect 1.023.454 (should be "10.234,54")
console.log('incorrect', mask.masked(mask.unmasked('10.234,54')), '!==', '10.234,54')
```
### Reproduction link
[Example](https://jsfiddle.net/m12wvzth/)
16 条评论