Verifications
A TypeScript Ready universal verification library (Server-Side and Client-Side) for developers.
[TOC]
Installation
npm i -s verifications
Usage
require / import
// Node.js :const Verifications = ;// ES6 :;// Typescript :;
Available Methods
- NationalID
- verify(code: string, locale?: string): boolean
- CreditCard
- verify(code: string): boolean
- type(code: string): string | undefined
- issuer(code: string): { name: string, alias: string, website: string } | undefined
- identify(code: string): { type: Type, issuer: Issuer } | undefined
- Phone
- identify(number: string): identity: { [key: string]: any } | undefined
- country(number: string): { name: string, alias: string } | undefined
- fancy(number: string): string
- normalize(number: string): string
NationalID
Verify
Verifications NationalID ;// returns true if the code matches any supported format
you can also enforce the locale
Verifications NationalID ;
Supported Locales:
- Iran (IR) - کد ملی
- United States (US) - Social Security Number (SSN)
- United Kingdom (UK) - National Insurance Number (NINO)
CreditCard
Verify
Verifications CreditCard ;// returns true if the code matches any supported format
Identify
Verifications CreditCard ;// returns identity of the card/issuer
Type
Verifications CreditCard type'xxxx-xxxx-xxxx-xxxx';// returns type of the card
Issuer
Verifications CreditCard ;// returns issuer of the card
Luhn verification algorithm (almost all credit cards around the globe)
- 9 card/issuer types
- 46 active issuers are supported
Phone
Identify
Verifications Phone ;// returns the identity of the number or undefined
Country
Verifications Phone ;// returns the country of the number or undefined
Fancy
Verifications Phone ;// returns the beautified format if supported or the given number
Normalize
Verifications Phone ;// returns numbers only -> xxxxxxxxxxxx