faker icon indicating copy to clipboard operation
faker copied to clipboard

CIF generator

Open randreu28 opened this issue 1 year ago • 6 comments

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

randreu28 avatar Oct 31 '23 12:10 randreu28

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

View more issues which are waiting for user interest

github-actions[bot] avatar Oct 31 '23 12:10 github-actions[bot]

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.

matthewmayer avatar Oct 31 '23 12:10 matthewmayer

[...] 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.

xDivisionByZerox avatar Oct 31 '23 12:10 xDivisionByZerox

A generic en locale could probably return a DUNS number. That's fairly standard internationally.

matthewmayer avatar Oct 31 '23 12:10 matthewmayer

Ah there's actually an open issue for DUNS number also https://github.com/faker-js/faker/issues/1202

matthewmayer avatar Oct 31 '23 13:10 matthewmayer

Something like faker.helpers.fromRegExp("[ABCDEFGHJNPQRSUVW][0-9]{7}[0-9A-J]") should work as a workaround for making CIF numbers in the meantime.

matthewmayer avatar Oct 31 '23 13:10 matthewmayer