fnando / cpf_cnpj

🇧🇷 Validate, generate and format CPF/CNPJ numbers. Include command-line tools.
MIT License
238 stars 42 forks source link

Valid CPF returning nil in validation #16

Closed JhoMartins closed 3 years ago

JhoMartins commented 4 years ago

This is a valid cpf number 01234567890 but when I call the CPF.valid? function I have this behavior: Screen Shot 2019-10-25 at 11 50 13

fnando commented 3 years ago

Sorry for taking forever to answer this. Yeah, that's fine. nil is a falsy value, and you shouldn't have any issues with it, unless you're type checking.

If you really need a boolean, use !!CPF.valid?(number, strict: true) to coerce the returning value.