Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stdnum

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stdnum

Standard Number Validation

  • 1.9.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
decreased by-62.15%
Maintainers
1
Weekly downloads
 
Created
Source

Country Standard Numbers

Build

JavaScript (TypeScript) package to validate most all national numbers, with a focus on VAT, Person and Tax identifiers.

Quick start

import { stdnum } from 'stdnum';

console.log(stdnum.BR.cpf.name); // 'Brazilian National Identifier',
console.log(stdnum.BR.cpf.localName); // 'Cadastro de Pessoas Físicas',
console.log(stdnum.BR.cpf.abbreviation); // 'CPF',

const {
    isValid, // is false
    error, // InvalidLength: The number has an invalid length...
} = stdnum.BR.cpf.validate('xyzzy');

const {
    isValid, // true
    compact, // '39053344705'
    isIndividual, // true
    isEntity, // false
} = stdnum.BR.cpf.validate("390.533.447-05");

All country validators are in the "namespace" of the ISO country code.

Supported Countries and Numbers

CountryCodeNameGroupMeaning
AndorraADNRTTaxTax Register Identifier (Número de Registre Tributari)
AlbaniaALNIPTVatAlbanian Vat Identifier (Numri i Identifikimit për Personin e Tatueshëm)
ArgentinaARCBUBankSingle Banking Code (Clave Bancaria Uniforme)
ArgentinaARCUITTaxUnique Tax Identification Code (Código Único de Identificación Tributaria)
ArgentinaARDNIPersonNational Identity Document (Documento Nacional de Identidad)
AustriaATBusinessidCompanyAustrian Company Register Number
AustriaATTINTaxAustrian tax identification number (Abgabenkontonummer)
AustriaATUIDVATAustrian VAT number (Umsatzsteuer-Identifikationsnummer)
AustriaATVNRPersonAustrian social security number(Versicherungsnummer)
AustraliaAUABNCompanyAustralian Business Number
AustraliaAUACNCompanyAustralian Company Number
AustraliaAUTFNTax/Person/CompanyAustralian Tax File Number
Bosnia and HerzegovinaBAJMBGPersonUnique Master Citizen Number
BelizeBZTINPerson/CompanyBrazilian Tax ID ()
BelgiumBEBISPersonBelgian Number for Foreigners
BelgiumBEINSZ, NISSPersonBelgian Social Security Identification Number (Identificatienummer van de Sociale Zekerheid, Numéro d'Identification Sécurité Sociale)
BelgiumBENNPersonBelgian National Number (Numéro National)
BelgiumBEVATCompanyBelgian Enterprise Number
BulgariaBGEGNPersonЕГН, Единен граждански номер, Bulgarian personal identity codes
BulgariaBGPNFPersonPNF (ЛНЧ, Личен номер на чужденец, Bulgarian number of a foreigner).
BulgariaBGVATCompanyИдентификационен номер по ДДС, Bulgarian VAT number
BrazilBRCPFPersonBrazilian identity number (Cadastro de Pessoas Físicas)
BrazilBRCNPJCompanyBrazilian company number (Cadastro Nacional da Pessoa Jurídica)
BelarusBYUNPPerson/CompanyУчетный номер плательщика, the Belarus VAT number
CanadaCABNCompanyCompany Identifier (Canadian Business Number)
CanadaCASINPersonPerson Identifier (Social Insurance Number)
CubaCUNIPersonNúmero de identidad, Cuban identity card numbers
CyprusCYVATCompanyΑριθμός Εγγραφής Φ.Π.Α. (Cypriot VAT number)
Czech RepublicCZDICCompanyDaňové identifikační číslo, Czech VAT number
Czech RepublicCZRCPersonRodné číslo, the Czech birth number
SwisserlandCHSSNPersonSwiss social security number ("Sozialversicherungsnummer")
SwisserlandCHUIDCompanyUnternehmens-Identifikationsnummer, Swiss business identifier
SwisserlandCHVATCompanyMehrwertsteuernummer, the Swiss VAT number
ChileCLRUTTaxTax Identifier (Rol Unico Tributario) [RUN]
ChinaCNRICPersonPerson Identifier (Chinese Resident Identity Card Number)
ChinaCNUSCCCompanyCompany Identifier (Unified Social Credit Code, 统一社会信用代码, China tax number)
ColumbiaCONITTaxTax Identifier (Número de Identificación Tributaria)
Costa RicaCRCPFPersonPerson Identifier (Cédula de Persona Física)
Costa RicaCRCPJCompanyCompany Identifier (Cédula de Persona Jurídica)
Costa RicaCRCRPersonPerson Identifier (Cédula de Residencia)
GermanyDEIDNRPersonSteuerliche Identifikationsnummer, German personal tax number
GermanyDEPassportPersonPassport Number
GermanyDESTNRCompanySteuernummer, German tax number
GermanyDESVNRPersonSozialversicherungsnummer, German social security / pension insurance number number
GermanyDEVATCompanyVat identifier
DenmarkDKVATCompanyMomsregistreringsnummer, Danish VAT number
Dominican RepublicDOCEDULAPersonPerson Identifier (Cédula de Residencia)
Dominican RepublicDONCFVatTax Receipt Number (Números de Comprobante Fiscal)
Dominican RepublicDORNCTaxPerson Identifier (Registro Nacional del Contribuyente)
AlgeriaDZNIFPerson/CompanyNuméro d'Identification Fiscale, Algeria tax number
EcuadorECCIPersonEcuadorian person identifier (Cédula de identidad)
EstoniaEEIKPersonIsikukood (Estonian Personcal ID number).
EstoniaEEKMKRCompanyKMKR (Käibemaksukohuslase, Estonian VAT number)
EstoniaEERegistrikoodCompanyRegistrikood (Estonian organisation registration code)
EgyptEGTNCompanyTax Registration Number (الرقم الضريبي, Egypt tax number)
EcuadorECRUCTax/VatEcuadorian company tax number (Registro Único de Contribuyentes)
El SalvadorSVNITTaxTax Identifier (Número de Identificación Tributaria)
FinlandFIALVCompanyALV nro (Arvonlisäveronumero, Finnish VAT number)
FinlandFIHETUPersonHETU (Henkilötunnus, Finnish personal identity code)
FinlandFIYTUNNUSCompanyY-tunnus (Finnish business identifier)
Faroe IslandsFOVNCompany/PersonVinnutal, Faroe Islands tax number
FranceFRNIFPersonNIF (Numéro d'Immatriculation Fiscale, French tax identification number)
Great BritainGBNINOPersonNINO (United Kingdom National Insurance Number)
Great BritainGBUTRPersonUTR (United Kingdom Unique Taxpayer Reference)
Great BritainGBVATCompanyVAT (United Kingdom (and Isle of Man) VAT registration number)
GhanaGHTINPerson/CompanyTaxpayer Identification Number, Ghana tax number
GuineaGNNIFPPerson/CompanyNuméro d'Identification Fiscale Permanent, Guinea tax number
GreeceGRAMKACompanyAMKA (Αριθμός Μητρώου Κοινωνικής Ασφάλισης, Greek social security number)
GuatemalaGTCUIPersonGuatemala person (Código Único de Identificación)
GuatemalaGTNITCompanyGuatemala company tax number (Número de Identificación Tributaria)
GreeceGRVATCompanyFPA, ΦΠΑ, ΑΦΜ (Αριθμός Φορολογικού Μητρώου, the Greek VAT number)
FranceFRNIRPersonNIR (French personal identification number)
FranceFRSIRENCompanySIREN (a French company identification number)
FranceFRSIRETCompanySIRET (a French company establishment identification number)
FranceFRTVAVatVAT Identifier
CroatiaHROIBPersonOsobni identifikacijski broj, Croatian identification number
Hong KongHKHKIDPersonHong Kong Identity Card
HungariaHUANUMVatANUM (Közösségi adószám, Hungarian VAT number)
IcelandISKENNITALAPerson/CompanyIcelandic personal and organisation identity code
IcelandISVSKVatVirðisaukaskattsnúmer, Icelandic VAT number
IndonesiaIDNPWPPerson/CompanyNPWP (Nomor Pokok Wajib Pajak, Indonesian VAT Number).
IrelandIEPPSPersonPersonal Public Service Number, Irish personal number
IrelandIEVATTax/VatIreland Value Added Tax ID
IndiaINAADHAARCompanyIndian digital resident personal identity number
IndiaINEPICPersonElectoral Photo Identity Card, Indian Voter ID
IndiaINGSTINVatGoods and Services Tax identification number, Indian VAT number
IndiaINPANPersonPermanent Account Number, Indian income tax identifier
IsraelILIDNRPersonIdentity Number (Mispar Zehut, מספר זהות, Israeli identity number)
IsraelILHRCompanyCompany Number (מספר חברה, or short ח.פ. Israeli company number)
ItalyITAICDrugItalian code for identification of drugs
ItalyITCODICEFISCALEPersonCodice Fiscale (Italian tax code for individuals)
ItalyITIVAVatPartita IVA (Italian VAT number)
LiechtensteinLIPEIDPerson/CompanyPersonenidentifikationsnummer
LithuanianLTASMENSPersonAsmens kodas (Person Number)
LithuanianLTPVMVatPridėtinės vertės mokestis mokėtojo kodas
LuxembourgianLUTVAVattaxe sur la valeur ajoutée
LatvianLVPVNPerson/VatPievienotās vērtības nodokļa
MoroccoMAICECompanyIdentifiant Commun de l'Entreprise, Moroccan new registration number
MacedoniaMKEDBVatЕдниствен Даночен Број, North Macedonia tax number
MacedoniaMKJMBGPersonUnique Master Citizen Number (Единствен матичен број на граѓанинот)
MonacoMCTVAVattaxe sur la valeur ajoutée, Monacan VAT number
MoldaviaMDIDNOVatMoldavian VAT number
MaltaMTVATVatMaltese VAT number
MauritiusMUNIDPersonID number (Mauritian national identifier)
JapanJPCNCompany法人番号, hōjin bangō, Japanese Corporate Number
KenyaKEPINPerson/CompanyPersonal Identification Number, Kenya tax number
South KoreaKRBRNCompany사업자 등록 번호, South Korea Business Registration Number)
South KoreaKRRRNPersonSouth Korean resident registration number
MexicoMXRFCTax/VatTax Identifier (Registro Federal de Contribuyentes)
MexicoMXCURPPersonIndividual Identifier (Clave Única de Registro de Población)
MexicoMXCLABEBankBank Account (Clave Bancaria Estandarizada)
MontenegroMEJMBGPersonUnique Master Citizen Number
MontenegroMEPIBTax/VatPoreski Identifikacioni Broj, Montenegro tax number
MalaysiaMYNRICPersonMalaysian National Registration Identity Card Number
NetherlandsNLBSNPersonBurgerservicenummer, the Dutch citizen identification number
NetherlandsNLBTWVatBtw-identificatienummer (Omzetbelastingnummer, the Dutch VAT number)
NetherlandsNLOnderwijsnummerPersonOnderwijsnummer (the Dutch student identification number)
New ZealandNZIRDPerson/CompanyNew Zealand Inland Revenue Department (Te Tari Tāke) number
New ZealandNZBANKBankNew Zealand Bank Account numbers - checkdigit
NorwayNOFodselsPersonFødselsnummer (Norwegian birth number, the national identity number)
NorwayNOKontoBankKonto nr. (Norwegian bank account number)
NorwayNOMVAVatMerverdiavgift, Norwegian VAT number
NorwayNOOrgnrCompanyOrganisasjonsnummer, Norwegian organisation number
ParaguayPYRUCTax/VatTax Identifier (Registro Único de Contribuyentes)
PeruPECUIPersonPerson Identifier (Cédula Única de Identidad)
PeruPERUCTax/VatTax Identifier (Registro Único de Contribuyentes)
PeruPECEPersonPerson Identifier (Carné de Extranjería)
PakistanPKCNICPersonNational Identity Card
PakistanPKNTNCompanyTax Identification Number
PolandPLNIPVatNumer Identyfikacji Podatkowej, Polish VAT number
PolandPLPESELPersonPolish national identification number
PolandPLREGONCompanyRejestr Gospodarki Narodowej, Polish register of economic units
PortugualPTCCPerson/CompanyNúmero de Cartão de Cidadão, Portuguese Identity number
PortugualPTNIFVatNúmero de identificação fiscal, Portuguese VAT number
RussiaRUINNTax/VatTax Identifier (Идентификационный номер налогоплательщика)
RomaniaROCFVatCod de înregistrare în scopuri de TVA, Romanian VAT number
RomaniaROCNPPersonCod Numeric Personal, Romanian Numerical Personal Code)
RomaniaROCUITaxCodul Unic de Înregistrare, Romanian company identifier
RomaniaROONRCCompanyOrdine din Registrul Comerţului, Romanian Trade Register identifier
San MarinoSMCOECompanyCodice operatore economico, San Marino national tax number
SerbiaRSPIBVatPoreski identifikacioni broj Tax identification number
SerbiaRSJMBGPersonUnique Master Citizen Number (Jedinstveni matični broj građana)
SwedenSEORGNRCompanyOrganisationsnummer, Swedish company number
SwedenSEPERSONNUMMERPersonPersonnummer (Swedish personal identity number)
SwedenSEVATVatVAT (Moms, Mervärdesskatt, Swedish VAT number)
SingaporeSGUENCompanySingapore's Unique Entity Number
ThailandTHIDNRPersonThai National ID (บัตรประจำตัวประชาชนไทย)
ThailandTHMOACompanyThailand Memorandum of Association Number
ThailandTHTINCompany/PersonThai Tax ID (Moa or Idnr)
TunisiaTNMFVatMatricule Fiscal, Tunisia tax number
TaiwanTWBANCompanyTaiwanese Unified Business Number (統一編號)
TaiwanTWNATIDPersonNational ID Card Number
TaiwanTWTAX_CODEPersonTax Code
TaiwanTWUBNCompanyUnified Business Number, 統一編號, Taiwanese tax number
TaiwanTWUIPersonUI Number
TurkeyTRTCKIMLIKPersonTürkiye Cumhuriyeti Kimlik Numarası (Personal ID)
TurkeyTRVKNTaxVergi Kimlik Numarası, Turkish tax identification number
SloveniaSIDDVVatID za DDV (Davčna številka, Slovenian VAT number)
SloveniaSIJMBGPersonUnique Master Citizen Number (Enotna matična številka občana)
SlovakiaSKDPHVatIČ DPH (IČ pre daň z pridanej hodnoty, Slovak VAT number)
SlovakiaSKRCPersonRČ (Rodné číslo, the Slovak birth number)
SpainESCIFTax/VatTax Identifier (Código de Identificación Fiscal)
SpainESDNIPersonIdentity code (Documento Nacional de Identidad)
SpainESNIEPersonIdentity code foreigner (Número de Identificación de Extranjero)
SpainESNIFTaxTax Identifier (Número de Identificación Fiscal)
SpainESNSSPersonEl número de Seguridad Social, Social Security Number
UruguayUYRUTTax/VatTax Identifier (Registro Único Tributario)
UruguayUYCEDULAPersonPerson Identifier (Cédula de Residencia)
UruguayUYNIEPersonForeignersI identification Number
UkraineUARNTRCPersonКПП, RNTRC (Individual taxpayer registration number in Ukraine)
UkraineUAEDRPOUCompanyЄДРПОУ, EDRPOU (Identifier for enterprises and organizations in Ukraine)
United StatesUSEINTax/CompanyTax Identifier (Employer Identification Number)
United StatesUSSSNTax/IndividualTax Identifier (Social Security Number)
VenezuelanVERIFVatVat Identifier (Registro de Identificación Fiscal)
VietnamVNMSTCompanyMã số thuế, Vietnam tax number
South AfricaZAIDNRPersonID number (South African Identity Document number).
South AfricaZATINPerson/CompanyTIN (South African Tax Identification Number).

Examples

TODO -- Usage examples

Credits

Thanks to python-stdnum for providing the inspiration and many of the checksum algorithm sources

References

https://wiki.scn.sap.com/wiki/display/CRM/Country+Tax+Category+check

Release Notes

This project is now using https://github.com/semantic-release/semantic-release to manage the release process. Commit messages should use the format specified to handle the major/minor/patch versioning information.

This is based on the angular commit message format https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format

Keywords

FAQs

Package last updated on 10 Jul 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc