Faker.js: Request: Social Security Number (SSN)

Created on 11 Aug 2017  路  6Comments  路  Source: Marak/faker.js

Have a SSN option would be great.

Most helpful comment

馃憤

Why would this be restricted to a single locale? In the Netherlands we also have a SSN, although it does have a different name in dutch (burgerservicenummer / bsn).

But why would this be handled differently than a postal code?
http://faker.hook.io/?property=address.zipCode&locale=nl -> 9203 AB
http://faker.hook.io/?property=address.zipCode&locale=de -> 66719

I vote for using the existing mechanism:
http://faker.hook.io/?property=person.ssn&locale=us -> 421450174 or 421-45-0174
http://faker.hook.io/?property=person.ssn&locale=nl -> 111222333 or 111.222.333

The usage of person is just a namespace I thought of, it could be located in an existing namespace like name.

All 6 comments

This would be en_US only?

Would you provide the full range, or have the option to get back specific numbers based on date or region?

Will accept a PR for this.

I've been using faker.phone.phoneNumber('#########') as a workaround!

馃憤

Why would this be restricted to a single locale? In the Netherlands we also have a SSN, although it does have a different name in dutch (burgerservicenummer / bsn).

But why would this be handled differently than a postal code?
http://faker.hook.io/?property=address.zipCode&locale=nl -> 9203 AB
http://faker.hook.io/?property=address.zipCode&locale=de -> 66719

I vote for using the existing mechanism:
http://faker.hook.io/?property=person.ssn&locale=us -> 421450174 or 421-45-0174
http://faker.hook.io/?property=person.ssn&locale=nl -> 111222333 or 111.222.333

The usage of person is just a namespace I thought of, it could be located in an existing namespace like name.

I know the US Social Security has a particular validation structure that would need to be followed, I assume the Netherlands has the same sort of rules.

Can we assume this faker will only generate "valid" numbers?

https://en.wikipedia.org/wiki/Social_Security_number#Structure

I've been using faker.phone.phoneNumber('#########') as a workaround!

Agree. This is a very easy workaround and the feature would only be relevant to US developers.

Add dashes if you care to faker.phone.phoneNumber("###-##-####")

In Brazil, the Social Security Number equivalent is called Cadastro de Pessoa Fisica, or CPF for short. There's the handy node-cpf package that generates valid CPF numbers, and also deals with masking and unmasking.

For the specific pt_BR locale, it would be simple to implement this SSN method by relying on the node-cpf package, and I believe the community could handle implementing validators for the other locales (if there's none already available). Speaking for myself, I would be glad to help :)

Was this page helpful?
0 / 5 - 0 ratings