faker
faker copied to clipboard
Add DUNS number generation
Clear and concise description of the problem
DUNS (Data Universal Numbering System) numbers are unique, nine-digit codes that helps identify businesses. Users of the system include Apple, the US government, the UN, and more. These numbers are standardized worldwide, and it is standard for businesses to have them.
We already have generation for SWIFT codes (banks), IBAN codes (bank accounts), vehicle identification numbers, mongodb object IDs, etc., we should add a company ID generation method. DUNS numbers would be perfect for this, because they are widely used as a public business entity identifier.
I can submit a PR for this issue if it is accepted.
Suggested solution
As DUNS numbers are nine-digit randomly generated numbers, this method can be written as a wrapper around random.numeric.
In the company module, the method should return as follows:
faker.company.duns() // "060704780"
faker.company.duns() // "059501224"
Alternative
No response
Additional context
No response
What options could be provided for this method?
I was thinking about:
format
Type: 'basic' | 'DUNS+4'
Default: 'basic'
Description: Defines the results format.
Description for 'basic': A basic 9-digit DUNS string.
Example for 'basic': '192837465'.
Description for 'DUNS+4': A 9-digit DUNS string with four extra alphanumeric characters at the end.
Example for 'DUNS+4': '192837465LJ20'
readable
Type: boolean
Default: false
Description: Defines if the results should be easier readable for humans.
Example for false: '192837465'.
Example for true: '19-283-7465'
Waiting for user interest.
What options could be provided for this method?
I was thinking about:
format
Type:
'basic' | 'DUNS+4'Default:'basic'Description: Defines the results format.Description for
'basic': A basic 9-digit DUNS string. Example for'basic':'192837465'.Description for
'DUNS+4': A 9-digit DUNS string with four extra alphanumeric characters at the end. Example for'DUNS+4':'192837465LJ20'readable
Type:
booleanDefault:falseDescription: Defines if the results should be easier readable for humans.Example for
false:'192837465'. Example fortrue:'19-283-7465'
For the readable option, how would we split the number? The Wikipedia doesn't say how to split it. Because the number is usually 9 digits, I think we should split it "3-3-3", like this: 491-571-583. If it is a DUNS+4 number, I think it should be split "3-3-3-4", like this: 491-571-583-F1U7.
Would love to look at contributing by adding this when the interest is there
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