Skip to content

Conversation

@ygorazambuja
Copy link

feat(isCpf)

Add Brazilian CPF Validation (Cadastro de Pessoas Fisicas)

Widely used in programs that use personal registration

@ygorazambuja ygorazambuja changed the title Add Brazilian CPF validation feat(isCpf): Add Brazilian CPF validation Oct 3, 2021
@codecov
Copy link

codecov bot commented Oct 3, 2021

Codecov Report

Merging #1755 (462c897) into master (4ec30b7) will decrease coverage by 0.09%.
The diff coverage is 91.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master    #1755      +/-   ##
===========================================
- Coverage   100.00%   99.90%   -0.10%     
===========================================
  Files          102      103       +1     
  Lines         2029     2053      +24     
  Branches       457      462       +5     
===========================================
+ Hits          2029     2051      +22     
- Misses           0        1       +1     
- Partials         0        1       +1     
Impacted Files Coverage Δ
src/lib/isCpf.js 91.30% <91.30%> (ø)
src/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ec30b7...462c897. Read the comment docs.

Copy link
Contributor

@fedeci fedeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a sort of VAT number, right?

@ygorazambuja
Copy link
Author

I think this is a sort of VAT number, right?

yes, sort of.

@fedeci
Copy link
Contributor

fedeci commented Oct 3, 2021

Because I think it would be better to add it to isVAT, then.

@ygorazambuja
Copy link
Author

Because I think it would be better to add it to isVAT, then.

its not simple as VAT, CPF Validation require some math calculation, and works only for Brazil.

@fedeci
Copy link
Contributor

fedeci commented Oct 3, 2021

Of course it is exclusive to brazil, also in Italy it is called IVA instead of VAT, but the meaning is practically the same. I'd suggest you to implement it in the isVAT file under the brazilian locale.

@ygorazambuja
Copy link
Author

Of course it is exclusive to brazil, also in Italy it is called IVA instead of VAT, but the meaning is practically the same. I'd suggest you to implement it in the isVAT file under the brazilian locale.

It will lose its meaning, vat is tax identification number, cpf is registration of individuals.

No Brazilian will search for VAT Validation, they will search for CPF Validation.

I myself didn't know about the existence of VAT until this PR

@fedeci
Copy link
Contributor

fedeci commented Oct 3, 2021

Let's ear maintainer's opinions :)
/cc @tux-tn @profnandaa @ezkemboi

@ygorazambuja
Copy link
Author

Let's ear maintainer's opinions :) /cc @tux-tn @profnandaa @ezkemboi

sure :)

@tux-tn
Copy link
Member

tux-tn commented Oct 4, 2021

Hello @ygorazambuja and thank you for your PR!
it looks like the CPF validation has already been implemented in isTaxID (see #1613 for more info).

@fedeci
Copy link
Contributor

fedeci commented Oct 4, 2021

What is the difference between isTaxID and isVAT?

@tux-tn
Copy link
Member

tux-tn commented Oct 4, 2021

What is the difference between isTaxID and isVAT?

Honestly i don't know, in my country Tax ID and VAT number are the same thing (it's called tax registration number) but it looks like many countries have two separated identifiers. May be we need to dig into this and merge the two validators!

@fedeci
Copy link
Contributor

fedeci commented Oct 4, 2021

In Italy they are the same number. Probably it is different just in GB?

@ygorazambuja
Copy link
Author

Hello @ygorazambuja and thank you for your PR! it looks like the CPF validation has already been implemented in isTaxID (see #1613 for more info).

it's like that, but I still don't agree with the name of the method, it makes it difficult to adhere to the library (in relation to this specific method of course).

I will close the PR so, thanks for the feedbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants