Skip to content

Commit bfdb3da

Browse files
authored
Merge pull request #16 from enricodias/master
Simplificando a verificação de CNPJs inválidos conhecidos
2 parents ff614b7 + 5f43134 commit bfdb3da

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

jquery.cpfcnpj.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,8 @@
100100
function validate_cnpj(val, msk) {
101101
val = val.replace(/[^\d]+/g, '');
102102

103-
if (val == '') return false;
104-
105-
if (val.length != 14)
106-
return false;
107-
108-
// Elimina CNPJs invalidos conhecidos
109-
if (val == "00000000000000" ||
110-
val == "11111111111111" ||
111-
val == "22222222222222" ||
112-
val == "33333333333333" ||
113-
val == "44444444444444" ||
114-
val == "55555555555555" ||
115-
val == "66666666666666" ||
116-
val == "77777777777777" ||
117-
val == "88888888888888" ||
118-
val == "99999999999999")
103+
// Elimina CNPJs inválidos conhecidos
104+
if (val == '' || val.length != 14 || /^(.)\1+$/.test(val))
119105
return false;
120106

121107
// Valida DVs

jquery.cpfcnpj.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)