@patrickdronk/vat-number
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

EUROPEAN VAT NUMBER

npm version

This library validates an european VAT number and gets the related business data through the VIES API

How to use it

  • Install the library first with yarn add @adriantombu/vat-number
  • And then import it in your script
const { getVatNumberInfos } = require('@adriantombu/vat-number')

const vatNumber = 'FR16817871668';
const checkedVat = await getVatNumberInfos(vatNumber)

{
  country: 'FR',
  vatNumber: '16817871668',
  fullVatNumber: 'FR16817871668',
  name: 'SASU OTSO',
  address: 'CS 21531\n59 ALL JEAN JAURES\n31000 TOULOUSE',
  valid: true
}

In case of an invalid VAT number, you will receive the following result, with the value valid set to false

const { getVatNumberInfos } = require('@adriantombu/vat-number')

const vatNumber = 'FRXXXXXXXXXX8';
const checkedVat = await getVatNumberInfos(vatNumber)

{
  fullVatNumber: 'FRXXXXXXXXXX8',
  message: 'The VAT number provided is not valid',
  valid: false
}

How to contribute

  • Clone the repository git clone git@github.com:adriantombu/vat-number.git
  • Install the packages with yarn install
  • Modify the src/index.ts file
  • When everything's done, you can send a PR \o/

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.8
    3
    • latest

Version History

Package Sidebar

Install

npm i @patrickdronk/vat-number

Weekly Downloads

3

Version

2.0.8

License

MIT

Unpacked Size

16.5 kB

Total Files

27

Last publish

Collaborators

  • patrickdronk