paemuri / brdoc

Brazilian docs validator for Go - CPF, CNPJ, CEP, RENAVAM, CNH and license plate!
The Unlicense
126 stars 27 forks source link

Add generic function IsDocument #6

Closed guilhermesteves closed 4 years ago

guilhermesteves commented 4 years ago

Better than if brdoc.IsCPF(document) || brdoc.IsCNPJ(document) { everywhere

paemuri commented 4 years ago

Hey, Guilherme! Thanks for spending your time trying to improve this project! I think I can't see the problem this PR is trying to solve. I don't think brdoc.IsCPF(...) || brdoc.IsCNPJ(...) is such an annoying boilerplate and, if it is, it seems like something the codebase importing this library should be worried about. Personally, I'd rather leave the library without this smaller functions and let the API simpler. Again, thank you for your help! 😄

guilhermesteves commented 4 years ago

Ok, thanks for the feedback. I'll be using the fork. I've stumbled in a project where this verification was constant and it kind of annoyed me. :sweat_smile: