package
Social Security Number validator and masker
npm install ssn-validatorGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Validate and mask a U.S. Social Security Number (SSN).
Install the package via npm:
npm install ssn-validator --saveisValid(value)This method validates if the given value is a valid Social Security Number.
value (*): The value to validate.(boolean): Returns whether the input value is a valid SSN or not.
isValid({});
// => false
isValid('0-1-1234567');
// => false
isValid('011-23-4567');
// => true
isValid('011234567');
// => truemask(value)This method will help you protect this sensitive piece of information by obfuscating some digits.
value (*): The value to mask.(string): Returns the masked value by replacing value certain digits by 'X'.
mask({});
// Throws an Error.
mask('0-1-1234567');
// Throws an Error.
mask('011-23-4567');
// => XXX-XX-4567
mask('011234567');
// => XXXXX4567To test using a local installation of node.js:
npm testTo test using Docker exclusively:
docker-compose run --rm sutnpm version [<newversion> | major | minor | patch] -m "Release %s"MIT
botatuphold
bot@uphold.com