Socket
Book a DemoInstallSign in
Socket

ssn-validation

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssn-validation

Social Security Number validator and masker

3.0.0
latest
Source
npmnpm
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

ssn-validation

Validate and mask a U.S. Social Security Number (SSN). Validate and mask Canadian SIN's too.

Installation

Install the package via npm:

npm install ssn-validation --save

Usage

isValid(value)

This method validates if the given value is a valid Social Security Number.

Arguments

  • value (*): The value to validate.

Returns

(boolean): Returns whether the input value is a valid SSN or not.

Example

isValid({});
// => false

isValid('0-1-1234567');
// => false

isValid('011-23-4567');
// => true

isValid('011234567');
// => true

mask(value)

This method will help you protect this sensitive piece of information by obfuscating some digits.

Arguments

  • value (*): The value to mask.

Returns

(string): Returns the masked value by replacing value certain digits by 'X'.

Example

mask({});
// Throws an Error.

mask('0-1-1234567');
// Throws an Error.

mask('011-23-4567');
// => XXX-XX-4567

mask('011234567');
// => XXXXX4567

Tests

To test using a local installation of node.js:

npm test

License

MIT

Keywords

IRS

FAQs

Package last updated on 27 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.