Skip to content

paemuri/brdoc

Repository files navigation

BR Doc

License go.dev Go Report Card

CPF, CNPJ, CEP, CNH, PIS/PASEP, RENAVAM, CNS, license plate and voter ID validator for Go!

Everything in this file, but the License section, is in portuguese.

Descrição

BR Doc é um pacote para validação, tanto do formato quanto dos dígitos, de documentos brasileiros.

Aceito PRs de todas as formas. Está permitido escrever em português, também. :)

Uso

Principais funções:

  • func IsCPF(doc string) bool
  • func IsCNPJ(doc string) bool
  • func IsCEP(doc string) (isValid bool, uf UF)
  • func IsCEPFrom(doc string, ufs ...UF) bool
  • func IsCNH(doc string) bool
  • func IsPIS(doc string) bool
  • func IsRENAVAM(doc string) bool
  • func IsPlate(doc string) bool
  • func IsNationalPlate(doc string) bool
  • func IsMercosulPlate(doc string) bool
  • func IsCNS(doc string) bool
  • func IsRG(doc string, uf UF) bool
  • func IsVoterID(doc string) bool
  • func IsPhone(phone string) (isValid bool, uf UF)
  • func IsPhoneFrom(phone string, ufs ...UF) bool

Coisas a fazer

  • validação de CPF
  • validação de CNPJ
  • validação de CEP
  • validação de CNH (obrigado @eminetto!)
  • validação de RENAVAM (obrigado @leogregianin!)
  • validação de placa veicular
  • validação de CNS (obrigado @renatosuero!)
  • validação de título de eleitor (obrigado @tiagompalte!)
  • validação de telefone (obrigado @tiagompalte e @ArtusC!)
  • validação de RG
    • SP (obrigado @robas!)
    • RJ (obrigado @robas!)
    • demais estados

License

This project code is in the public domain. See the LICENSE file.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be in the public domain, without any additional terms or conditions.

About

Brazilian docs validator for Go - CPF, CNPJ, CEP, RENAVAM, CNH and license plate!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

Languages