Nitrogenous Polymorphic Molecule

    @adriantombu/siret-to-vat
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.10 • Public • Published

    SIREN/SIREN to VAT number

    npm version

    This small library converts a French SIREN or SIRET to a valid VAT number. You can then use the vat number library to check it against the official European records.

    How to use it

    • Install the library first with yarn add @adriantombu/siret-to-vat
    • And then import it in your script
    const { convertToVatNumber } = require('@adriantombu/siret-to-vat')
    
    const siren = 817871668
    const vat = convertToVatNumber(siren)
    
    {
      vatNumber: "FR16817871668",
      valid: true
    }
    

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

    const { convertToVatNumber } = require('@adriantombu/siret-to-vat')
    
    const siren = 123456'
    const vat = convertToVatNumber(siren)
    
    {
      vatNumber: 123456',
      message: 'The number provided must be a SIREN (9 caracters) or SIREN (14 caracters)',
      valid: false
    }
    

    How to contribute

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

    Install

    npm i @adriantombu/siret-to-vat

    DownloadsWeekly Downloads

    4

    Version

    3.0.10

    License

    MIT

    Unpacked Size

    9.36 kB

    Total Files

    7

    Last publish

    Collaborators

    • adriantombu