Socket
Socket
Sign inDemoInstall

@accountable/jsvat

Package Overview
Dependencies
0
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.1

41

lib/cjs/index.js

@@ -17,6 +17,41 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.countries = void 0;
const jsvat_organizer_1 = require("./jsvat.organizer");
exports.countries = jsvat_organizer_1.countriesMap;
exports.unitedKingdom = exports.switzerland = exports.sweden = exports.spain = exports.slovenia = exports.slovakiaRepublic = exports.serbia = exports.russia = exports.romania = exports.portugal = exports.poland = exports.norway = exports.netherlands = exports.malta = exports.luxembourg = exports.lithuania = exports.latvia = exports.italy = exports.ireland = exports.hungary = exports.greece = exports.germany = exports.france = exports.finland = exports.europe = exports.estonia = exports.denmark = exports.czechRepublic = exports.cyprus = exports.croatia = exports.bulgaria = exports.brazil = exports.belgium = exports.austria = exports.andorra = exports.countries = void 0;
var jsvat_organizer_1 = require("./jsvat.organizer");
Object.defineProperty(exports, "countries", { enumerable: true, get: function () { return jsvat_organizer_1.countries; } });
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return jsvat_organizer_1.andorra; } });
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return jsvat_organizer_1.austria; } });
Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return jsvat_organizer_1.belgium; } });
Object.defineProperty(exports, "brazil", { enumerable: true, get: function () { return jsvat_organizer_1.brazil; } });
Object.defineProperty(exports, "bulgaria", { enumerable: true, get: function () { return jsvat_organizer_1.bulgaria; } });
Object.defineProperty(exports, "croatia", { enumerable: true, get: function () { return jsvat_organizer_1.croatia; } });
Object.defineProperty(exports, "cyprus", { enumerable: true, get: function () { return jsvat_organizer_1.cyprus; } });
Object.defineProperty(exports, "czechRepublic", { enumerable: true, get: function () { return jsvat_organizer_1.czechRepublic; } });
Object.defineProperty(exports, "denmark", { enumerable: true, get: function () { return jsvat_organizer_1.denmark; } });
Object.defineProperty(exports, "estonia", { enumerable: true, get: function () { return jsvat_organizer_1.estonia; } });
Object.defineProperty(exports, "europe", { enumerable: true, get: function () { return jsvat_organizer_1.europe; } });
Object.defineProperty(exports, "finland", { enumerable: true, get: function () { return jsvat_organizer_1.finland; } });
Object.defineProperty(exports, "france", { enumerable: true, get: function () { return jsvat_organizer_1.france; } });
Object.defineProperty(exports, "germany", { enumerable: true, get: function () { return jsvat_organizer_1.germany; } });
Object.defineProperty(exports, "greece", { enumerable: true, get: function () { return jsvat_organizer_1.greece; } });
Object.defineProperty(exports, "hungary", { enumerable: true, get: function () { return jsvat_organizer_1.hungary; } });
Object.defineProperty(exports, "ireland", { enumerable: true, get: function () { return jsvat_organizer_1.ireland; } });
Object.defineProperty(exports, "italy", { enumerable: true, get: function () { return jsvat_organizer_1.italy; } });
Object.defineProperty(exports, "latvia", { enumerable: true, get: function () { return jsvat_organizer_1.latvia; } });
Object.defineProperty(exports, "lithuania", { enumerable: true, get: function () { return jsvat_organizer_1.lithuania; } });
Object.defineProperty(exports, "luxembourg", { enumerable: true, get: function () { return jsvat_organizer_1.luxembourg; } });
Object.defineProperty(exports, "malta", { enumerable: true, get: function () { return jsvat_organizer_1.malta; } });
Object.defineProperty(exports, "netherlands", { enumerable: true, get: function () { return jsvat_organizer_1.netherlands; } });
Object.defineProperty(exports, "norway", { enumerable: true, get: function () { return jsvat_organizer_1.norway; } });
Object.defineProperty(exports, "poland", { enumerable: true, get: function () { return jsvat_organizer_1.poland; } });
Object.defineProperty(exports, "portugal", { enumerable: true, get: function () { return jsvat_organizer_1.portugal; } });
Object.defineProperty(exports, "romania", { enumerable: true, get: function () { return jsvat_organizer_1.romania; } });
Object.defineProperty(exports, "russia", { enumerable: true, get: function () { return jsvat_organizer_1.russia; } });
Object.defineProperty(exports, "serbia", { enumerable: true, get: function () { return jsvat_organizer_1.serbia; } });
Object.defineProperty(exports, "slovakiaRepublic", { enumerable: true, get: function () { return jsvat_organizer_1.slovakiaRepublic; } });
Object.defineProperty(exports, "slovenia", { enumerable: true, get: function () { return jsvat_organizer_1.slovenia; } });
Object.defineProperty(exports, "spain", { enumerable: true, get: function () { return jsvat_organizer_1.spain; } });
Object.defineProperty(exports, "sweden", { enumerable: true, get: function () { return jsvat_organizer_1.sweden; } });
Object.defineProperty(exports, "switzerland", { enumerable: true, get: function () { return jsvat_organizer_1.switzerland; } });
Object.defineProperty(exports, "unitedKingdom", { enumerable: true, get: function () { return jsvat_organizer_1.unitedKingdom; } });
__exportStar(require("./jsvat.index"), exports);
__exportStar(require("./jsvat.type"), exports);

7

lib/cjs/jsvat.index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkVAT = exports.countries = void 0;
exports.checkVAT = void 0;
const jsvat_organizer_1 = require("./jsvat.organizer");

@@ -37,3 +37,3 @@ /*

}
const countriesVATDoesNotStartWithCountryCode = [jsvat_organizer_1.countriesMap.brazil.name];
const countriesVATDoesNotStartWithCountryCode = [jsvat_organizer_1.countries.brazil.name];
function isVATStartWithCountryCode(countryName) {

@@ -73,4 +73,3 @@ return !countriesVATDoesNotStartWithCountryCode.includes(countryName);

}
exports.countries = Object.values(jsvat_organizer_1.countriesMap);
function checkVAT(vat, countriesList = exports.countries) {
function checkVAT(vat, countriesList = Object.values(jsvat_organizer_1.countries)) {
if (!vat)

@@ -77,0 +76,0 @@ return makeResult(vat, false);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.countriesMap = void 0;
exports.countries = exports.unitedKingdom = exports.switzerland = exports.sweden = exports.spain = exports.slovenia = exports.slovakiaRepublic = exports.serbia = exports.russia = exports.romania = exports.portugal = exports.poland = exports.norway = exports.netherlands = exports.malta = exports.luxembourg = exports.lithuania = exports.latvia = exports.italy = exports.ireland = exports.hungary = exports.greece = exports.germany = exports.france = exports.finland = exports.europe = exports.estonia = exports.denmark = exports.czechRepublic = exports.cyprus = exports.croatia = exports.bulgaria = exports.brazil = exports.belgium = exports.austria = exports.andorra = void 0;
const andorra_1 = require("./countries/andorra");
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return andorra_1.andorra; } });
const austria_1 = require("./countries/austria");
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return austria_1.austria; } });
const belgium_1 = require("./countries/belgium");
Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return belgium_1.belgium; } });
const brazil_1 = require("./countries/brazil");
Object.defineProperty(exports, "brazil", { enumerable: true, get: function () { return brazil_1.brazil; } });
const bulgaria_1 = require("./countries/bulgaria");
Object.defineProperty(exports, "bulgaria", { enumerable: true, get: function () { return bulgaria_1.bulgaria; } });
const croatia_1 = require("./countries/croatia");
Object.defineProperty(exports, "croatia", { enumerable: true, get: function () { return croatia_1.croatia; } });
const cyprus_1 = require("./countries/cyprus");
Object.defineProperty(exports, "cyprus", { enumerable: true, get: function () { return cyprus_1.cyprus; } });
const czechRepublic_1 = require("./countries/czechRepublic");
Object.defineProperty(exports, "czechRepublic", { enumerable: true, get: function () { return czechRepublic_1.czechRepublic; } });
const denmark_1 = require("./countries/denmark");
Object.defineProperty(exports, "denmark", { enumerable: true, get: function () { return denmark_1.denmark; } });
const estonia_1 = require("./countries/estonia");
Object.defineProperty(exports, "estonia", { enumerable: true, get: function () { return estonia_1.estonia; } });
const europe_1 = require("./countries/europe");
Object.defineProperty(exports, "europe", { enumerable: true, get: function () { return europe_1.europe; } });
const finland_1 = require("./countries/finland");
Object.defineProperty(exports, "finland", { enumerable: true, get: function () { return finland_1.finland; } });
const france_1 = require("./countries/france");
Object.defineProperty(exports, "france", { enumerable: true, get: function () { return france_1.france; } });
const germany_1 = require("./countries/germany");
Object.defineProperty(exports, "germany", { enumerable: true, get: function () { return germany_1.germany; } });
const greece_1 = require("./countries/greece");
Object.defineProperty(exports, "greece", { enumerable: true, get: function () { return greece_1.greece; } });
const hungary_1 = require("./countries/hungary");
Object.defineProperty(exports, "hungary", { enumerable: true, get: function () { return hungary_1.hungary; } });
const ireland_1 = require("./countries/ireland");
Object.defineProperty(exports, "ireland", { enumerable: true, get: function () { return ireland_1.ireland; } });
const italy_1 = require("./countries/italy");
Object.defineProperty(exports, "italy", { enumerable: true, get: function () { return italy_1.italy; } });
const latvia_1 = require("./countries/latvia");
Object.defineProperty(exports, "latvia", { enumerable: true, get: function () { return latvia_1.latvia; } });
const lithuania_1 = require("./countries/lithuania");
Object.defineProperty(exports, "lithuania", { enumerable: true, get: function () { return lithuania_1.lithuania; } });
const luxembourg_1 = require("./countries/luxembourg");
Object.defineProperty(exports, "luxembourg", { enumerable: true, get: function () { return luxembourg_1.luxembourg; } });
const malta_1 = require("./countries/malta");
Object.defineProperty(exports, "malta", { enumerable: true, get: function () { return malta_1.malta; } });
const netherlands_1 = require("./countries/netherlands");
Object.defineProperty(exports, "netherlands", { enumerable: true, get: function () { return netherlands_1.netherlands; } });
const norway_1 = require("./countries/norway");
Object.defineProperty(exports, "norway", { enumerable: true, get: function () { return norway_1.norway; } });
const poland_1 = require("./countries/poland");
Object.defineProperty(exports, "poland", { enumerable: true, get: function () { return poland_1.poland; } });
const portugal_1 = require("./countries/portugal");
Object.defineProperty(exports, "portugal", { enumerable: true, get: function () { return portugal_1.portugal; } });
const romania_1 = require("./countries/romania");
Object.defineProperty(exports, "romania", { enumerable: true, get: function () { return romania_1.romania; } });
const russia_1 = require("./countries/russia");
Object.defineProperty(exports, "russia", { enumerable: true, get: function () { return russia_1.russia; } });
const serbia_1 = require("./countries/serbia");
Object.defineProperty(exports, "serbia", { enumerable: true, get: function () { return serbia_1.serbia; } });
const slovakiaRepublic_1 = require("./countries/slovakiaRepublic");
Object.defineProperty(exports, "slovakiaRepublic", { enumerable: true, get: function () { return slovakiaRepublic_1.slovakiaRepublic; } });
const slovenia_1 = require("./countries/slovenia");
Object.defineProperty(exports, "slovenia", { enumerable: true, get: function () { return slovenia_1.slovenia; } });
const spain_1 = require("./countries/spain");
Object.defineProperty(exports, "spain", { enumerable: true, get: function () { return spain_1.spain; } });
const sweden_1 = require("./countries/sweden");
Object.defineProperty(exports, "sweden", { enumerable: true, get: function () { return sweden_1.sweden; } });
const switzerland_1 = require("./countries/switzerland");
Object.defineProperty(exports, "switzerland", { enumerable: true, get: function () { return switzerland_1.switzerland; } });
const unitedKingdom_1 = require("./countries/unitedKingdom");
exports.countriesMap = {
Object.defineProperty(exports, "unitedKingdom", { enumerable: true, get: function () { return unitedKingdom_1.unitedKingdom; } });
exports.countries = {
andorra: andorra_1.andorra,

@@ -41,0 +76,0 @@ austria: austria_1.austria,

@@ -1,40 +0,4 @@

export declare const countries: {
andorra: import("./jsvat.type").CountryConfig;
austria: import("./jsvat.type").CountryConfig;
belgium: import("./jsvat.type").CountryConfig;
brazil: import("./jsvat.type").CountryConfig;
bulgaria: import("./jsvat.type").CountryConfig;
croatia: import("./jsvat.type").CountryConfig;
cyprus: import("./jsvat.type").CountryConfig;
czechRepublic: import("./jsvat.type").CountryConfig;
denmark: import("./jsvat.type").CountryConfig;
estonia: import("./jsvat.type").CountryConfig;
europe: import("./jsvat.type").CountryConfig;
finland: import("./jsvat.type").CountryConfig;
france: import("./jsvat.type").CountryConfig;
germany: import("./jsvat.type").CountryConfig;
greece: import("./jsvat.type").CountryConfig;
hungary: import("./jsvat.type").CountryConfig;
ireland: import("./jsvat.type").CountryConfig;
italy: import("./jsvat.type").CountryConfig;
latvia: import("./jsvat.type").CountryConfig;
lithuania: import("./jsvat.type").CountryConfig;
luxembourg: import("./jsvat.type").CountryConfig;
malta: import("./jsvat.type").CountryConfig;
netherlands: import("./jsvat.type").CountryConfig;
norway: import("./jsvat.type").CountryConfig;
poland: import("./jsvat.type").CountryConfig;
portugal: import("./jsvat.type").CountryConfig;
romania: import("./jsvat.type").CountryConfig;
russia: import("./jsvat.type").CountryConfig;
serbia: import("./jsvat.type").CountryConfig;
slovakiaRepublic: import("./jsvat.type").CountryConfig;
slovenia: import("./jsvat.type").CountryConfig;
spain: import("./jsvat.type").CountryConfig;
sweden: import("./jsvat.type").CountryConfig;
switzerland: import("./jsvat.type").CountryConfig;
unitedKingdom: import("./jsvat.type").CountryConfig;
};
export { countries, andorra, austria, belgium, brazil, bulgaria, croatia, cyprus, czechRepublic, denmark, estonia, europe, finland, france, germany, greece, hungary, ireland, italy, latvia, lithuania, luxembourg, malta, netherlands, norway, poland, portugal, romania, russia, serbia, slovakiaRepublic, slovenia, spain, sweden, switzerland, unitedKingdom, } from './jsvat.organizer';
export * from './jsvat.index';
export * from './jsvat.type';
//# sourceMappingURL=index.d.ts.map
import { CountryConfig, VatCheckResult } from './jsvat.type';
export declare const countries: CountryConfig[];
export declare function checkVAT(vat: string, countriesList?: ReadonlyArray<CountryConfig>): VatCheckResult;
//# sourceMappingURL=jsvat.index.d.ts.map

@@ -1,39 +0,74 @@

import { CountryConfig } from './jsvat.type';
export declare const countriesMap: {
andorra: CountryConfig;
austria: CountryConfig;
belgium: CountryConfig;
brazil: CountryConfig;
bulgaria: CountryConfig;
croatia: CountryConfig;
cyprus: CountryConfig;
czechRepublic: CountryConfig;
denmark: CountryConfig;
estonia: CountryConfig;
europe: CountryConfig;
finland: CountryConfig;
france: CountryConfig;
germany: CountryConfig;
greece: CountryConfig;
hungary: CountryConfig;
ireland: CountryConfig;
italy: CountryConfig;
latvia: CountryConfig;
lithuania: CountryConfig;
luxembourg: CountryConfig;
malta: CountryConfig;
netherlands: CountryConfig;
norway: CountryConfig;
poland: CountryConfig;
portugal: CountryConfig;
romania: CountryConfig;
russia: CountryConfig;
serbia: CountryConfig;
slovakiaRepublic: CountryConfig;
slovenia: CountryConfig;
spain: CountryConfig;
sweden: CountryConfig;
switzerland: CountryConfig;
unitedKingdom: CountryConfig;
import { andorra } from './countries/andorra';
import { austria } from './countries/austria';
import { belgium } from './countries/belgium';
import { brazil } from './countries/brazil';
import { bulgaria } from './countries/bulgaria';
import { croatia } from './countries/croatia';
import { cyprus } from './countries/cyprus';
import { czechRepublic } from './countries/czechRepublic';
import { denmark } from './countries/denmark';
import { estonia } from './countries/estonia';
import { europe } from './countries/europe';
import { finland } from './countries/finland';
import { france } from './countries/france';
import { germany } from './countries/germany';
import { greece } from './countries/greece';
import { hungary } from './countries/hungary';
import { ireland } from './countries/ireland';
import { italy } from './countries/italy';
import { latvia } from './countries/latvia';
import { lithuania } from './countries/lithuania';
import { luxembourg } from './countries/luxembourg';
import { malta } from './countries/malta';
import { netherlands } from './countries/netherlands';
import { norway } from './countries/norway';
import { poland } from './countries/poland';
import { portugal } from './countries/portugal';
import { romania } from './countries/romania';
import { russia } from './countries/russia';
import { serbia } from './countries/serbia';
import { slovakiaRepublic } from './countries/slovakiaRepublic';
import { slovenia } from './countries/slovenia';
import { spain } from './countries/spain';
import { sweden } from './countries/sweden';
import { switzerland } from './countries/switzerland';
import { unitedKingdom } from './countries/unitedKingdom';
export { andorra, austria, belgium, brazil, bulgaria, croatia, cyprus, czechRepublic, denmark, estonia, europe, finland, france, germany, greece, hungary, ireland, italy, latvia, lithuania, luxembourg, malta, netherlands, norway, poland, portugal, romania, russia, serbia, slovakiaRepublic, slovenia, spain, sweden, switzerland, unitedKingdom, };
export declare const countries: {
andorra: import("./jsvat.type").CountryConfig;
austria: import("./jsvat.type").CountryConfig;
belgium: import("./jsvat.type").CountryConfig;
brazil: import("./jsvat.type").CountryConfig;
bulgaria: import("./jsvat.type").CountryConfig;
croatia: import("./jsvat.type").CountryConfig;
cyprus: import("./jsvat.type").CountryConfig;
czechRepublic: import("./jsvat.type").CountryConfig;
denmark: import("./jsvat.type").CountryConfig;
estonia: import("./jsvat.type").CountryConfig;
europe: import("./jsvat.type").CountryConfig;
finland: import("./jsvat.type").CountryConfig;
france: import("./jsvat.type").CountryConfig;
germany: import("./jsvat.type").CountryConfig;
greece: import("./jsvat.type").CountryConfig;
hungary: import("./jsvat.type").CountryConfig;
ireland: import("./jsvat.type").CountryConfig;
italy: import("./jsvat.type").CountryConfig;
latvia: import("./jsvat.type").CountryConfig;
lithuania: import("./jsvat.type").CountryConfig;
luxembourg: import("./jsvat.type").CountryConfig;
malta: import("./jsvat.type").CountryConfig;
netherlands: import("./jsvat.type").CountryConfig;
norway: import("./jsvat.type").CountryConfig;
poland: import("./jsvat.type").CountryConfig;
portugal: import("./jsvat.type").CountryConfig;
romania: import("./jsvat.type").CountryConfig;
russia: import("./jsvat.type").CountryConfig;
serbia: import("./jsvat.type").CountryConfig;
slovakiaRepublic: import("./jsvat.type").CountryConfig;
slovenia: import("./jsvat.type").CountryConfig;
spain: import("./jsvat.type").CountryConfig;
sweden: import("./jsvat.type").CountryConfig;
switzerland: import("./jsvat.type").CountryConfig;
unitedKingdom: import("./jsvat.type").CountryConfig;
};
//# sourceMappingURL=jsvat.organizer.d.ts.map
{
"name": "@accountable/jsvat",
"version": "1.1.1",
"version": "1.2.1",
"description": "Check the validity of the format of a VAT number",

@@ -42,10 +42,13 @@ "exports": {

"typescript",
"esm",
"cjs",
"nodejs",
"commonjs",
"ecmascript",
"beginner",
"example",
"demonstration"
"vat",
"vat number",
"vat number validation",
"vat number validator",
"vat number checker",
"vat number check",
"vat number format",
"vat number format validation",
"vat-number",
"eu-vat-number",
"vat-number-validation"
],

@@ -52,0 +55,0 @@ "author": "accountable.eu",

@@ -26,2 +26,3 @@ <h1><p align="center">@accountable/jsvat</p></h1>

- Rewritten into Typescript :new:
- No dependencies

@@ -56,6 +57,4 @@ - No http calls

```javascript
import { checkVAT, countries } from '@accountable/jsvat';
import { checkVAT, belgium, austria } from '@accountable/jsvat';
const { belgium, austria } = countries;
checkVAT('BE0411905847', [belgium]); // true: accept only Belgium VATs

@@ -78,3 +77,2 @@ checkVAT('BE0411905847', [belgium, austria]); // true: accept only Belgium or Austria VATs

import { checkVAT, countries } from '@accountable/jsvat';
import _omit from 'lodash/omit';

@@ -147,3 +145,3 @@ const { france, germany, ...countriesToValidate } = countries;

## Extend countries list - add your own country:
## Extend countries list - add your own country

@@ -157,3 +155,2 @@ You can add your own country.

codes: ReadonlyArray<string>;
calcFn: (vat: string, options?: object) => boolean; //options - isn't a mandatory param
rules: {

@@ -163,3 +160,7 @@ multipliers: {}; // you can leave it empty

};
}
} & ({
calcFn: (vat: string, options?: object) => boolean; // use this if you want to check only format of VAT
} | {
calcWithFormatFn: (vat: string, options?: object) => {isValid: boolean, vat: string}; // use this if you want to check format of VAT and re-format it
})
```

@@ -166,0 +167,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc