faker-js / faker

Generate massive amounts of fake data in the browser and node.js
https://fakerjs.dev
Other
12.34k stars 892 forks source link

Add DUNS number generation #1202

Open import-brain opened 2 years ago

import-brain commented 2 years ago

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

xDivisionByZerox commented 2 years ago

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'

ST-DDT commented 2 years ago

Waiting for user interest.

import-brain commented 2 years ago

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'

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.

ageddesi commented 1 year ago

Would love to look at contributing by adding this when the interest is there

github-actions[bot] commented 1 year ago

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community: