npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

corporate-taxid-checker-js

v1.0.0

Published

Validate Global Tax IDs: A robust and comprehensive library for validating tax identification numbers (TINs) worldwide. It supports validation against standard regex patterns and offers extended verification through checksum algorithms for countries with

Downloads

227

Readme

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 Code | Country | Regex Check | Checksum Check | Online Check ---|---|---|---|--- AD | Andorra | ✅ | ✅ | AE | United Arab Emirates | ✅ | | AL | Albania | ✅ | ✅ | AM | Armenia | ✅ | | AR | Argentina | ✅ | ✅ | AT | Austria | ✅ | ✅ | AU | Australia | ✅ | ✅ | AZ | Azerbaijan | | ✅ | BD | Bangladesh | ✅ | | BE | Belgium | ✅ | ✅ | BG | Bulgaria | ✅ | ✅ | BO | Bolivia | ✅ | | BR | Brazil | ✅ | ✅ | BY | Belarus | | ✅ | BZ | Belize | ✅ | ✅ | CA | Canada | ✅ | ✅ | CH | Switzerland | ✅ | ✅ | CL | Chile | ✅ | ✅ | CN | China | ✅ | ✅ | CO | Colombia | ✅ | ✅ | CR | Costa Rica | ✅ | ✅ | CY | Cyprus | ✅ | ✅ | CZ | Czech Republic | ✅ | ✅ | DE | Germany | ✅ | ✅ | DK | Denmark | ✅ | ✅ | DO | Dominican Republic | ✅ | | DZ | Algeria | ✅ | | EC | Ecuador | ✅ | ✅ | EE | Estonia | ✅ | ✅ | EG | Egypt | ✅ | ✅ | ES | Spain | ✅ | ✅ | FI | Finland | ✅ | ✅ | FR | France | ✅ | ✅ | FO | Faroe Islands | ✅ | | GB | United Kingdom | ✅ | | GE | Georgia | ✅ | | GH | Ghana | ✅ | ✅ | GN | Guinea | ✅ | ✅ | GR | Greece | ✅ | | GT | Guatemala | ✅ | ✅ | HK | Hong Kong | ✅ | | HR | Croatia | ✅ | | HU | Hungary | ✅ | ✅ | ID | Indonesia | ✅ | ✅ | IE | Ireland | ✅ | ✅ | IL | Israel | ✅ | ✅ | IN | India | ✅ | ✅ | IS | Iceland | ✅ | | IT | Italy | ✅ | | JP | Japan | ✅ | ✅ | KE | Kenya | ✅ | | KH | Cambodia | ✅ | | KR | South Korea | ✅ | ✅ | LI | Liechtenstein | ✅ | | LT | Lithuania | ✅ | | LU | Luxembourg | ✅ | | LV | Latvia | ✅ | | MA | Morocco | ✅ | ✅ | FR | Monaco | ✅ | | MD | Moldova | ✅ | | ME | Montenegro | ✅ | ✅ | MK | North Macedonia | | ✅ | MT | Malta | ✅ | | MX | Mexico | ✅ | ✅ | MY | Malaysia | ✅ | | NG | Nigeria | ✅ | | NL | Netherlands | ✅ | ✅ | NO | Norway | ✅ | ✅ | NZ | New Zealand | ✅ | ✅ | PE | Peru | ✅ | ✅ | PH | Philippines | ✅ | | PL | Poland | ✅ | ✅ | PT | Portugal | ✅ | ✅ | PY | Paraguay | ✅ | ✅ | RO | Romania | ✅ | ✅ | RS | Serbia | ✅ | ✅ | RU | Russia | ✅ | ✅ | RW | Rwanda | ✅ | | SA | Saudi Arabia | ✅ | | SE | Sweden | ✅ | ✅ | SG | Singapore | ✅ | ✅ | SI | Slovenia | ✅ | ✅ | SK | Slovakia | ✅ | ✅ | SM | San Marino | ✅ | ✅ | SV | El Salvador | ✅ | ✅ | TH | Thailand | ✅ | ✅ | TN | Tunisia | ✅ | ✅ | TR | Turkey | ✅ | ✅ | TW | Taiwan | ✅ | ✅ | UA | Ukraine | ✅ | ✅ | US | United States | ✅ | | UY | Uruguay | ✅ | ✅ | VE | Venezuela | ✅ | ✅ | VN | Vietnam | ✅ | ✅ | ZA | South Africa | ✅ | ✅ | AD | Andorra | ✅ | ✅ | AE | United Arab Emirates | ✅ | | AL | Albania | ✅ | ✅ | AM | Armenia | ✅ | | AR | Argentina | ✅ | ✅ | AT | Austria | ✅ | ✅ | ✅ AU | Australia | ✅ | ✅ | ✅ AZ | Azerbaijan | | ✅ | BD | Bangladesh | ✅ | | BE | Belgium | ✅ | ✅ | ✅ BG | Bulgaria | ✅ | ✅ | ✅ BO | Bolivia | ✅ | | BR | Brazil | ✅ | ✅ | BY | Belarus | | ✅ | BZ | Belize | ✅ | ✅ | CA | Canada | ✅ | ✅ | CH | Switzerland | ✅ | ✅ | CL | Chile | ✅ | ✅ | CN | China | ✅ | ✅ | CO | Colombia | ✅ | ✅ | CR | Costa Rica | ✅ | ✅ | CY | Cyprus | ✅ | ✅ | ✅ CZ | Czech Republic | ✅ | ✅ | ✅ DE | Germany | ✅ | ✅ | ✅ DK | Denmark | ✅ | ✅ | ✅ DO | Dominican Republic | ✅ | | DZ | Algeria | ✅ | | EC | Ecuador | ✅ | ✅ | EE | Estonia | ✅ | ✅ | ✅ EG | Egypt | ✅ | ✅ | ES | Spain | ✅ | ✅ | ✅ FI | Finland | ✅ | ✅ | ✅ FR | France | ✅ | ✅ | FO | Faroe Islands | ✅ | | GB | United Kingdom | ✅ | | GE | Georgia | ✅ | | GH | Ghana | ✅ | ✅ | GN | Guinea | ✅ | ✅ | GR | Greece | ✅ | | ✅ GT | Guatemala | ✅ | ✅ | HK | Hong Kong | ✅ | | HR | Croatia | ✅ | | ✅ HU | Hungary | ✅ | ✅ | ✅ ID | Indonesia | ✅ | ✅ | IE | Ireland | ✅ | ✅ | ✅ IL | Israel | ✅ | ✅ | IN | India | ✅ | ✅ | IS | Iceland | ✅ | | IT | Italy | ✅ | | ✅ JP | Japan | ✅ | ✅ | KE | Kenya | ✅ | | KH | Cambodia | ✅ | | KR | South Korea | ✅ | ✅ | LI | Liechtenstein | ✅ | | LT | Lithuania | ✅ | | ✅ LU | Luxembourg | ✅ | | ✅ LV | Latvia | ✅ | | ✅ MA | Morocco | ✅ | ✅ | FR | Monaco | ✅ | | MD | Moldova | ✅ | | ME | Montenegro | ✅ | ✅ | MK | North Macedonia | | ✅ | MT | Malta | ✅ | | ✅ MX | Mexico | ✅ | ✅ | MY | Malaysia | ✅ | | NG | Nigeria | ✅ | | NL | Netherlands | ✅ | ✅ | ✅ NO | Norway | ✅ | ✅ | NZ | New Zealand | ✅ | ✅ | PE | Peru | ✅ | ✅ | PH | Philippines | ✅ | | PL | Poland | ✅ | ✅ | ✅ PT | Portugal | ✅ | ✅ | ✅ PY | Paraguay | ✅ | ✅ | RO | Romania | ✅ | ✅ | ✅ RS | Serbia | ✅ | ✅ | RU | Russia | ✅ | ✅ | RW | Rwanda | ✅ | | SA | Saudi Arabia | ✅ | | SE | Sweden | ✅ | ✅ | ✅ SG | Singapore | ✅ | ✅ | SI | Slovenia | ✅ | ✅ | ✅ SK | Slovakia | ✅ | ✅ | ✅ SM | San Marino | ✅ | ✅ | SV | El Salvador | ✅ | ✅ | TH | Thailand | ✅ | ✅ | TN | Tunisia | ✅ | ✅ | TR | Turkey | ✅ | ✅ | TW | Taiwan | ✅ | ✅ | UA | Ukraine | ✅ | ✅ | US | United States | ✅ | | UY | Uruguay | ✅ | ✅ | VE | Venezuela | ✅ | ✅ | VN | Vietnam | ✅ | ✅ | ZA | South 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.