Skip to content

Instantly share code, notes, and snippets.

View gutierri's full-sized avatar

Gutierri Barboza gutierri

View GitHub Profile
@gutierri
gutierri / validate_cpf.js
Last active August 29, 2015 13:57 — forked from fabiomontefuscolo/gist:1095584
Validação de CPF
function validate_cpf(cpf) {
var sum, summod11;
cpf = cpf.replace(/[^0-9]/g, '');
if(cpf.length != 11 || cpf.match(/^([0-9])\1+$/)) {
return false;
}
// 9 primeiros digitos do cpf
var digit = Array.prototype.slice.call(cpf, 0, 9);