New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-jsvat

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-jsvat

Check the validity of the format of an EU VAT number specified

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-36.62%
Maintainers
0
Weekly downloads
 
Created
Source

DEPRECATED: Please do not use

Codacy Badge bitHound Overall Score bitHound Code Code Climate Bower version npm version devDependency Status GitHub license

NPM

angular-jsvat

Demo and Examples

Check the validity of the format of an EU VAT number. No dependencies(except angularjs of course).

What is it?

Angular-js wrapper for jsvat (jsvat it's a core-logic for vat validation)

angular-jsvat is a small library to check validity of European (and few non-eu) VAT number. (learn more about VAT) jsvat use 2-step check (see below) and didn't make any request for external resources.

Each country has own regexp for VAT number and different math-logic of number calculating.

For more details check jsvat repo.

What angular-jsvat do?

  1. Provide JsVatFactory facatory (just an angularjs wrapper for jsvat)

Just check is VAT number valid or not and which country this VAT is:

JsVatFactory.checkVAT('BG131134023'); // {isValid: true, country: 'bulgaria', value: 'BG131134023'}
JsVatFactory.checkVAT('BG0433170001'); //{isValid: false, country: null, value: 'BG0433170001'}
JsVatFactory.checkVAT('atu5-150-7409');  //{isValid: true, country: 'austria', value: 'ATU51507409'}
JsVatFactory.checkVAT('aTU 5 804 4146');  //{isValid: true, country: 'austria', value: 'ATU58044146'}

You can specify list of allowed countries

JsVatFactory.config = ['austria', 'belgium']; //All countries except 'austria' and 'belgium' would return false
JsVatFactory.checkVAT('BG131134023'); //valid VAT, but result would be 'false'

To reset config just do JsVatFactory.config = [];

  1. Provide jsvat directive (for inputs). Directive take a ngModel and return the result to the result object
<input jsvat="result" type="text" ng-model="model">

Installation

  1. Bower

bower i angular-jsvat --save

  1. NPM (node.js)

npm i angular-jsvat --save

  1. Directly download one of the latest releases:

https://github.com/se-panfilov/angular-jsvat/releases

After that, just include angular-jsvat as a dependency

angular.module('app', ['angular-jsvat'])

(no dependencies required, angular-jsvat is standalone app)

How does jsvat check the validity?

It use jsvat core functionality:

There is 2-step check:

  1. Compare with list of Regexps;

For example regexp for austria is /^(AT)U(\d{8})$/.

Looks like ATU99999999 is valid (it's successfied the regexp), but actually it's should be invalid.

  1. Some magic mathematical counting;

Here we make some mathematical calculation (different for each country). After that we may be sure that ATU99999999and for example ATV66889218 isn't valid, but ATU12011204 is valid.

List of supported Countries:

  • Austria
  • Belgium
  • Bulgaria
  • Switzerland
  • Cyprus
  • Czech Republic
  • Germany
  • Denmark
  • Greece
  • Spain
  • Europe
  • Finland
  • France
  • United Kingdom
  • Croatia
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithunia
  • Luxembourg
  • Malta
  • Netherlands
  • Norway
  • Poland
  • Portugal
  • Romania
  • Russia Federation
  • Serbia
  • Slovenia
  • Slovakia republic
  • Sweden

Browsers Supports

Support all browsers down to IE9 (including IE9).

LICENSE

MIT: https://github.com/se-panfilov/jsvat/blob/master/LICENSE

This project is provided "as is", without warranty of any kind. The authors and contributors disclaim all liability for any damages arising from its use, inability to use, or performance. Users are responsible for ensuring compliance with applicable laws and regulations in their jurisdiction, including but not limited to:

  • European Union: Cyber Resilience Act (CRA) and Artificial Intelligence Act (AI Act)
  • United States: Uniform Commercial Code (UCC) and Export Administration Regulations (EAR)
  • China: Cybersecurity Law
  • India: Information Technology Act

For details, see the full DISCLAIMER.md file.

Keywords

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc