faker
faker copied to clipboard
CIF generator
Clear and concise description of the problem
I need a CIF generator. CIF is the tax identification code for businesses in spain. Similar to the LEI identifier, but particulary for spanish businesses only.
Suggested solution
Create a method similar to this:
const cif = faker.company.cif();
console.log(cif); //F19262039
Some real examples of CIF validators: https://www.generador-de-dni.com/generador-de-dni
Alternative
No response
Additional context
No response
Thank you for your feature proposal.
We marked it as "waiting for user interest" for now to gather some feedback from our community:
- If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
- If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.
We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.
We will start the implementation based on:
- the number of votes (:+1:) and comments
- the relevance for the ecosystem
- availability of alternatives and workarounds
- and the complexity of the requested feature
We do this because:
- There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
- Every feature we add to faker has "costs" associated to it:
- initial costs: design, implementation, reviews, documentation
- running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors
This could potentially be localizable for example have
faker.company.number()
And then for the es locale it gives a CIF, for the en_GB locale it gives a UK Company number etc.
[...] Similar to the LEI identifier, but particulary for spanish businesses only. [...]
We support over 60 locales. Please tell me how other locales would use this. What is the expected behavior, for example, for fakerEN.company.cif()
? en
is our default locale. So it must not error on functions with an "not applicable" error.
A generic en locale could probably return a DUNS number. That's fairly standard internationally.
Ah there's actually an open issue for DUNS number also https://github.com/faker-js/faker/issues/1202
Something like faker.helpers.fromRegExp("[ABCDEFGHJNPQRSUVW][0-9]{7}[0-9A-J]")
should work as a workaround for making CIF numbers in the meantime.