@adia-technology/international-ssn-validator
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

International SSN Validator

This utility checks validity of Social Security Numbers. Currently supported countries are USA and Switzerland.

Getting started

Installation

npm install @adia-technology/international-ssn-validator --save

Usage

import { validateSsn, ValidationResult } from '@adia-technology/international-ssn-validator';

let validationResult = validateSsn('756.1111.2222.00', 'ch');
let isValid = validationResult === ValidationResult.Valid;

API

This library exposes a single function, validateSsn, that accepts two parameters:

  • ssn : string - SSN to validate.
  • countryCode : string - country for which to check the SSN against. Currently supported are us and ch.

It returns a ValidationResult, which essentially is a string enum being set to one of the values: 'VALID', 'INVALID_FORMAT' or 'INVALID_CHECKSUM'.

Dependencies

This library uses the following other libraries:

Readme

Keywords

Package Sidebar

Install

npm i @adia-technology/international-ssn-validator

Weekly Downloads

4

Version

0.3.1

License

MIT

Unpacked Size

7.13 kB

Total Files

14

Last publish

Collaborators

  • tech-adia
  • rnowosielski
  • m.pogorzelski
  • michaldepta
  • michaldudak
  • piotr_szperka