1.22.2 • Published 7 months ago

company-id-validator v1.22.2

Weekly downloads
62
License
MIT
Repository
github
Last release
7 months ago

Company id validator

This Javascript library helps you to validate and get detailed information for a company/business identifier. It's inspired from this awesome ptdnum python library

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

Why ?

  • Each country has its own company/business identifier and their name and validation algorithms are very specific from one country to another.
  • It is very difficult to gather information about local company identifiers: For example, do you know the name of the chinese company identifier ? it's format ? How to validate it ?
  • That's the purpose of this library

Demo

You can find a demo here

How to use it

  • npm install company-id-validator --save
  • You can now validate a company identifier based on its country code:
import { CompanyId } from 'company-id-validator';

CompanyId.validate('FR', '802070748'); // Should return true
  • You can also get detailed information:
import { CompanyId } from 'company-id-validator';

const info = CompanyId.info('FR', '802070748');
console.log(info);
{
  "valid": true,
  "query": "802070748",
  "sanitizedQuery": "802070748",
  "countryCode": "FR",
  "name": "SIREN",
  "fullName": "Système d'Identification du Répertoire des Entreprises",
  "type": "LOCAL_COMPANY_ID",
  "description": "The SIREN (Système d'Identification du Répertoire des Entreprises) is a 9\ndigit number used to identify French companies. The Luhn checksum is used\nto validate the numbers.",
  "trustedSourceUrl": "https://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises",
  "pattern": "^[0-9]{3}[ \\.\\-]?[0-9]{3}[ \\.\\-]?[0-9]{3}$",
  "parentLevel": true,
  "countryName": "France",
  "id": "802070748",
  "vatNumber": "FR89802070748"
}

Getting started

  • npm install to get node dependencies
  • npm run build to build the application

Tests

Unit tests

  • npm run test to start Jest tests.
  • npm run test:ci to run with coverage:
  • HTML and coverage reports are generated under the dist/test-results/html and dist/test-results/lcov-report folders.

Code quality

npm run lint. Will check your code based on .eslintrc.json config file

Roadmap

  • For now 15 countries are supported: AD, AL, AT, BE, CH, CN, DE, ES, FR, GB, IT, NI, NO, PL, SC, SE, JP
  • Need to add many more countries based on the ptdnum python library
1.22.2

7 months ago

1.22.1

1 year ago

1.22.0

1 year ago

1.21.4

1 year ago

1.21.5

1 year ago

1.21.6

1 year ago

1.21.7

1 year ago

1.19.0

2 years ago

1.18.1

2 years ago

1.18.2

2 years ago

1.21.0

2 years ago

1.21.1

1 year ago

1.20.0

2 years ago

1.21.2

1 year ago

1.21.3

1 year ago

1.18.0

2 years ago

1.17.1

2 years ago

1.17.0

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.13.2

2 years ago

1.14.0

2 years ago

1.13.1

2 years ago

1.13.0

2 years ago

1.12.0

2 years ago

1.11.0

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago