1.10.4 • Published 1 month ago

stdnum v1.10.4

Weekly downloads
350
License
MIT
Repository
github
Last release
1 month ago

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

How you can help! This library currently support about half the countries in the world. It would be great if we can get to 100%. Submit an issue with any reference documentation and I'll do my best to integrate it, bonus points if you can get detailed descriptions of checksums or other validation criteria.

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)
CanadaCAGSTCompanyGoods and service Tax Number
CanadaCAPSTCompanyProvincial Service Tax Number
CanadaCAQSTCompanyQuebec Service Tax 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
Sri LankaLKNICPersonNIC 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://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/ 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

1.10.4

1 month ago

1.10.3

2 months ago

1.10.2

4 months ago

1.6.4

10 months ago

1.6.3

10 months ago

1.6.2

10 months ago

1.6.1

10 months ago

1.6.0

10 months ago

1.9.16

8 months ago

1.9.15

8 months ago

1.9.14

8 months ago

1.9.13

9 months ago

1.9.12

9 months ago

1.9.11

9 months ago

1.9.10

10 months ago

1.9.1

10 months ago

1.9.0

10 months ago

1.5.3

10 months ago

1.5.2

11 months ago

1.5.1

11 months ago

1.6.9

10 months ago

1.6.8

10 months ago

1.6.7

10 months ago

1.6.6

10 months ago

1.6.5

10 months ago

1.10.1

8 months ago

1.10.0

8 months ago

1.8.2

10 months ago

1.8.1

10 months ago

1.8.0

10 months ago

1.9.9

10 months ago

1.9.8

10 months ago

1.9.7

10 months ago

1.9.6

10 months ago

1.9.5

10 months ago

1.6.11

10 months ago

1.9.4

10 months ago

1.6.10

10 months ago

1.9.3

10 months ago

1.6.13

10 months ago

1.9.2

10 months ago

1.6.12

10 months ago

1.7.1

10 months ago

1.7.0

10 months ago

1.5.0

1 year ago

1.4.13

1 year ago

1.4.12

1 year ago

1.4.15

1 year ago

1.4.14

1 year ago

1.4.11

1 year ago

1.4.10

2 years ago

1.4.9

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.3.0

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.0.10

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago