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 🙏

© 2026 – Pkg Stats / Ryan Hefner

company-id-validators

v0.1.0

Published

Offline validators for European company identifiers and EU VAT numbers: check digits and formats for ES, FR, GB, IE, PL, NO, FI, SE, BE, HR, DK, EE, SK, CH, US and LEI. Zero dependencies.

Readme

company-id-validators

Offline validators for European company identifiers and EU VAT numbers. Check digits and formats for 16 identifier types, no dependencies, no network, ES module and CommonJS, TypeScript types included. A Python port with the same API is published as company-id-validators on PyPI.

npm install company-id-validators
import { validateFrSiren, autoDetect, vatToCompanyNumber } from 'company-id-validators'
// const { validateFrSiren } = require('company-id-validators')

validateFrSiren('552 032 534')
// { ok: true, kind: 'SIREN (legal unit)', note: '...' }

validateFrSiren('552032535')
// { ok: false, reason: 'Fails the Luhn check digit.' }

autoDetect('PL7740001454').detectedAs   // 'eu-vat'
vatToCompanyNumber('BE', 'BE0417497106') // '0417.497.106'

Every validator takes a string and returns { ok, ... }. A failure carries a reason. A success carries kind and note, and the newer validators add checkDigit ('ok' | 'bad' | 'advisory_bad'), display (the canonical written form) and formatOnly.

A well-formed number is not proof that a company exists. Where a register publishes no check digit, or the check digit is only a guide, the result says so with formatOnly: true.

Identifiers

| Country | Identifier | Function | Checked | |---|---|---|---| | Spain | NIF / CIF / NIE | validateEsNif | check digit or letter | | France | SIREN | validateFrSiren | Luhn | | France | SIRET | validateFrSiret | Luhn (La Poste digit-sum rule) | | United Kingdom | company number | validateGbCompanyNumber | format only (no check digit exists) | | Ireland | CRO number | validateIeCro | format only (no check digit exists) | | Poland | NIP | validatePlNip | mod 11 | | Poland | REGON (9 and 14) | validatePlRegon | mod 11 | | Norway | organisasjonsnummer | validateNoOrgnr | mod 11 | | Finland | Y-tunnus | validateFiYtunnus | mod 11 | | Sweden | organisationsnummer | validateSeOrgnr | Luhn, third digit 2 or higher | | Belgium | enterprise number | validateBeEnterprise | mod 97 | | Croatia | OIB | validateHrOib | ISO 7064 MOD 11,10 | | Croatia | MBS | validateHrMbs | ISO 7064 MOD 11,10, advisory | | Denmark | CVR | validateDkCvr | mod 11, advisory | | Estonia | registrikood | validateEeRegistryCode | mod 11 | | Slovakia | IČO | validateSkIco | mod 11, advisory | | Switzerland | UID | validateChUid | mod 11 | | United States | state number, CIK, LEI-prefixed | validateUsNumber | format only | | Global | LEI (ISO 17442) | validateLei | ISO 7064 MOD 97-10 | | EU / XI | VAT number | validateEuVat | structure per country, plus the national check digit for ES, FR, PL, FI, SE, BE, HR, DK |

"Advisory" means the check digit is reported (checkDigit: 'advisory_bad', formatOnly: true) but the number is still accepted, because genuine numbers exist that fail it.

One example per country

import * as v from 'company-id-validators'

v.validateEsNif('A28015865')            // Spain
v.validateFrSiret('55203253400646')     // France
v.validateGbCompanyNumber('SC095237')   // United Kingdom (format only)
v.validateIeCro('100416')               // Ireland (format only)
v.validatePlNip('774-000-14-54')        // Poland
v.validateNoOrgnr('923609016')          // Norway
v.validateFiYtunnus('0112038-9')        // Finland
v.validateSeOrgnr('556012-5790')        // Sweden
v.validateBeEnterprise('0417.497.106')  // Belgium
v.validateHrOib('27759560625')          // Croatia
v.validateDkCvr('24256790')             // Denmark
v.validateEeRegistryCode('10060701')    // Estonia
v.validateSkIco('151653')               // Slovakia (read as 00151653)
v.validateChUid('CHE-242.294.601')      // Switzerland
v.validateUsNumber('NY-4424185')        // United States (format only)
v.validateLei('HWUPKR0MPOU8FGXBT394')   // LEI
v.validateEuVat('DK24256790')           // EU VAT

Helpers

  • autoDetect(input) guesses the type; the result has detectedAs ('fr-siren', 'eu-vat', ...) or null.
  • normaliseFiYtunnus, normaliseSeOrgnr, normaliseBeEnterprise, normaliseHrMbs, normaliseDkCvr, normaliseEeRegistryCode, normaliseSkIco, normaliseChUid, normaliseUsNumber return the canonical number or null.
  • vatToCompanyNumber(countryCode, vat) recovers the register number from a VAT number where that is possible (FI, SE, BE, DK, HR, CH), otherwise null.
  • looksLikePersonnummer(input) tells a Swedish personal number from an organisation number.
  • rawId(companyNumber) is the number's digits as an integer.
  • VALIDATORS lists every validator with an id and a label.

Need the company behind the number?

This package checks that a number is well-formed. The Prometiam API looks it up in the official registers.

License

MIT