-
-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random identity card number #416
Comments
What about locales that do not have a "national identity card"? The US doesn't have anything like that, would this function generate a Social Security number? Passport number? |
How about designing it more generic. We could use a Record<string, algorithm config> to define these things and the user has to know or lookup which generators are available for generateId(type: string). Or even more generically, a method that just takes the generation config and will build it for you. |
Yes, that would be nice in the long run, but I don't want to pass an algorithm or pattern as developer to faker, in that case I could just write it myself. |
Algorithimically generated ID numbers like the Ausweisnummer seem like a pretty heavy lift. Seems like these should have their own defined functions, perhaps as part of a locale. US Social Security numbers are easier, as they aren't algorithimically validated. You can get a US SSN using the existing
What might be cool is if this method could repeat string patterns as well as single characters, so that might condense down to:
Or perhaps with common format identifiers, e.g.:
There are likely multiple "National ID"s for any given country. The US has SSN, passport number, driver's license number (which varies by state), PASSID/KTN, license plates (again varying by state), etc. |
Since this varies greatly in both available ids and their implementation we have two choices:
I don't see this in v7 and even v8. |
If you are interested in this feature, please upvote this issue. |
Maybe this will help create some random number SSN-like value:
For a "valid" Honduras ID number:
It creates something that may work, but may create some invalid values, for Honduras ID, the first 2 digits is the Department, the next two digits is the municipality, next 4 is year issued, next 5 are indeed random. The year is easy to generate, but the first 4 requires more development. I like this idea:
|
Thank you for your feature proposal. We marked it as "waiting for user interest" for now to gather some feedback from our community:
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:
We do this because:
|
Clear and concise description of the problem
I would like to have a function to generate a random identity card number
In germany the implementation would follow this pattern: https://de.wikipedia.org/wiki/Ausweisnummer
Not sure right now how patterns in other country looks like, but in the long run I would need these also.
The sequence should be seed-based
Suggested solution
Implement a function that returns an identity card number that is seed-based and related to the current selected locale
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: