Commit Inicial.

This commit is contained in:
Leandro Costa 2022-02-01 17:09:16 -03:00
parent 337d192710
commit 5d307207d9
3 changed files with 44 additions and 22 deletions

17
src/lhmask.js Normal file
View file

@ -0,0 +1,17 @@
module.exports = {
// Entrada: 12345000 Saída: 12.345-000
formatarCep(txt) {
const soNumeros = e.target.value.replace(/[^\d]/g, '')
if (!soNumeros) onChange(soNumeros);
let cep = '';
cep += soNumeros.slice(0, 2);
if (soNumeros.length > 2)
cep += '.' + soNumeros.slice(2, 5);
if (soNumeros.length > 5)
cep += '-' + soNumeros.slice(5, 8);
return cep;
}
}