1.0.0 • Published 6 months ago

corporate-taxid-checker-js v1.0.0

Weekly downloads
-
License
CC BY 4.0
Repository
github
Last release
6 months ago

Tax ID Validator

Overview

Tax ID Validator is a robust tool designed for validating various tax identification numbers (TINs), such as GSTIN in India, UEN in Singapore, etc. The tool uses regular expressions and specific validation logic for each type of TIN, ensuring that the input adheres to the expected format and structural rules of the respective issuing authority.

Features

  • Supports multiple countries and TIN types.
  • Uses precise regular expressions for format validation.
  • Implements checksum logic for countries that incorporate checksum characters in their TINs.
  • Easy to integrate and use in various JavaScript environments.

Requirements

  • Node.js (v14 or newer recommended)

Installation

You can install the package via npm:

npm install corporate-taxid-checker-js

Usage

The tool can be used by importing the main validator function and then calling it with the appropriate parameters.

Here's a basic example:

const { validateTaxId } = require('corporate-taxid-checker-js');

const taxId = '1234567890';
const countryCode = 'IN'; // Use the appropriate country code

const result = validateTaxId(taxId, countryCode);
console.log(result); // logs true if valid, false if invalid

Validation Levels

For enhanced accuracy and reliability, our tool offers three levels of TIN validation for several countries:

  1. Regex Check: This initial check ensures the TIN adheres to the expected format using precise regular expressions.
  2. Checksum Validation: Based on the guidelines from the OECD, this check verifies the integrity of the TIN using its checksum.
  3. Authority Lookup (Available for EU countries and Australia): This advanced check confirms the validity of the TIN by directly querying the respective country's tax authority website.

Supported Countries and TINs

The Tax ID Validator currently supports tax identification number validation for the following countries:

Country CodeCountryRegex CheckChecksum CheckOnline Check
ADAndorra
AEUnited Arab Emirates
ALAlbania
AMArmenia
ARArgentina
ATAustria
AUAustralia
AZAzerbaijan
BDBangladesh
BEBelgium
BGBulgaria
BOBolivia
BRBrazil
BYBelarus
BZBelize
CACanada
CHSwitzerland
CLChile
CNChina
COColombia
CRCosta Rica
CYCyprus
CZCzech Republic
DEGermany
DKDenmark
DODominican Republic
DZAlgeria
ECEcuador
EEEstonia
EGEgypt
ESSpain
FIFinland
FRFrance
FOFaroe Islands
GBUnited Kingdom
GEGeorgia
GHGhana
GNGuinea
GRGreece
GTGuatemala
HKHong Kong
HRCroatia
HUHungary
IDIndonesia
IEIreland
ILIsrael
INIndia
ISIceland
ITItaly
JPJapan
KEKenya
KHCambodia
KRSouth Korea
LILiechtenstein
LTLithuania
LULuxembourg
LVLatvia
MAMorocco
FRMonaco
MDMoldova
MEMontenegro
MKNorth Macedonia
MTMalta
MXMexico
MYMalaysia
NGNigeria
NLNetherlands
NONorway
NZNew Zealand
PEPeru
PHPhilippines
PLPoland
PTPortugal
PYParaguay
RORomania
RSSerbia
RURussia
RWRwanda
SASaudi Arabia
SESweden
SGSingapore
SISlovenia
SKSlovakia
SMSan Marino
SVEl Salvador
THThailand
TNTunisia
TRTurkey
TWTaiwan
UAUkraine
USUnited States
UYUruguay
VEVenezuela
VNVietnam
ZASouth Africa
ADAndorra
AEUnited Arab Emirates
ALAlbania
AMArmenia
ARArgentina
ATAustria
AUAustralia
AZAzerbaijan
BDBangladesh
BEBelgium
BGBulgaria
BOBolivia
BRBrazil
BYBelarus
BZBelize
CACanada
CHSwitzerland
CLChile
CNChina
COColombia
CRCosta Rica
CYCyprus
CZCzech Republic
DEGermany
DKDenmark
DODominican Republic
DZAlgeria
ECEcuador
EEEstonia
EGEgypt
ESSpain
FIFinland
FRFrance
FOFaroe Islands
GBUnited Kingdom
GEGeorgia
GHGhana
GNGuinea
GRGreece
GTGuatemala
HKHong Kong
HRCroatia
HUHungary
IDIndonesia
IEIreland
ILIsrael
INIndia
ISIceland
ITItaly
JPJapan
KEKenya
KHCambodia
KRSouth Korea
LILiechtenstein
LTLithuania
LULuxembourg
LVLatvia
MAMorocco
FRMonaco
MDMoldova
MEMontenegro
MKNorth Macedonia
MTMalta
MXMexico
MYMalaysia
NGNigeria
NLNetherlands
NONorway
NZNew Zealand
PEPeru
PHPhilippines
PLPoland
PTPortugal
PYParaguay
RORomania
RSSerbia
RURussia
RWRwanda
SASaudi Arabia
SESweden
SGSingapore
SISlovenia
SKSlovakia
SMSan Marino
SVEl Salvador
THThailand
TNTunisia
TRTurkey
TWTaiwan
UAUkraine
USUnited States
UYUruguay
VEVenezuela
VNVietnam
ZASouth Africa

Testing

To run the included tests:

npm run test

Contributing

Contributions are welcome. Please fork the repository and submit a pull request with your changes. Ensure that your PR includes detailed information about the changes, including any new dependencies, environment variables, or required context.

License

This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) - see the LICENSE file for details.