Ajuste na regex da conta bancária para aceitar dígito X
This commit is contained in:
parent
d09e0e2728
commit
b7a18af8a3
2 changed files with 6 additions and 2 deletions
|
@ -68,7 +68,7 @@ function formatarCpfCnpj(txt) {
|
|||
|
||||
// Entrada: 12345 Saída: 1234-5
|
||||
function formatarContaBancaria(txt) {
|
||||
const soNumeros = `${txt}`.replace(/[^\d]/g, '')
|
||||
const soNumeros = `${txt}`.replace(/[^\dxX]/g, '')
|
||||
if (!soNumeros) return soNumeros;
|
||||
|
||||
let conta = '';
|
||||
|
|
|
@ -22,7 +22,11 @@ const testes = {
|
|||
},
|
||||
'contabancaria': {
|
||||
'fnName': "formatarContaBancaria",
|
||||
'valores': [['1234-5', '1234-5']]
|
||||
'valores': [
|
||||
['12345', '1234-5'],
|
||||
['12345x', '12345-x'],
|
||||
['12345X', '12345-X']
|
||||
]
|
||||
},
|
||||
'telefone': {
|
||||
'fnName': 'formatarTelefone',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue