JSPM

vies-validate

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 492
  • Score
    100M100P100Q95757F
  • License MIT

A Europe VAT Number Validator with VIES

Package Exports

  • vies-validate
  • vies-validate/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vies-validate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Getting started

Installation

npm install vies-validate

Usage

import { validate } from "vies-validate";

const { data, error } = await validate("NL", "853746333B01");

When valid:

data: {
  countryCode: 'xx',
  vatNumber: 'xxxxxxxxx',
  requestDate: '2013-11-22+01:00',
  valid: true,
  name: 'company name',
  address: 'company address'
}
error: null

When invalid:

data: {
  countryCode: 'xx',
  vatNumber: 'xxxxxxxxxx',
  requestDate: '2013-11-22+01:00',
  valid: false,
  name: '---',
  address: '---'
}
error: null

When error:

data: null;
error: "INVALID_INPUT";

License

The MIT License (MIT)