Skip to content

Commit

Permalink
Release/2.5.0 (#112)
Browse files Browse the repository at this point in the history
* bumped version

* update deps

* checkstyle

* build
  • Loading branch information
se-panfilov authored Dec 21, 2020
1 parent 2fb72b3 commit fd4250e
Show file tree
Hide file tree
Showing 186 changed files with 2,539 additions and 2,532 deletions.
73 changes: 37 additions & 36 deletions lib/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports", "./lib/countries", "./lib/countries", "./lib/jsvat"], function (require, exports, countries_1, countries_2, jsvat_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkVAT = 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;
exports.countries = [
countries_1.andorra,
countries_1.austria,
Expand Down Expand Up @@ -38,40 +39,40 @@ define(["require", "exports", "./lib/countries", "./lib/countries", "./lib/jsvat
countries_1.switzerland,
countries_1.unitedKingdom
];
exports.andorra = countries_2.andorra;
exports.austria = countries_2.austria;
exports.belgium = countries_2.belgium;
exports.brazil = countries_2.brazil;
exports.bulgaria = countries_2.bulgaria;
exports.croatia = countries_2.croatia;
exports.cyprus = countries_2.cyprus;
exports.czechRepublic = countries_2.czechRepublic;
exports.denmark = countries_2.denmark;
exports.estonia = countries_2.estonia;
exports.europe = countries_2.europe;
exports.finland = countries_2.finland;
exports.france = countries_2.france;
exports.germany = countries_2.germany;
exports.greece = countries_2.greece;
exports.hungary = countries_2.hungary;
exports.ireland = countries_2.ireland;
exports.italy = countries_2.italy;
exports.latvia = countries_2.latvia;
exports.lithuania = countries_2.lithuania;
exports.luxembourg = countries_2.luxembourg;
exports.malta = countries_2.malta;
exports.netherlands = countries_2.netherlands;
exports.norway = countries_2.norway;
exports.poland = countries_2.poland;
exports.portugal = countries_2.portugal;
exports.romania = countries_2.romania;
exports.russia = countries_2.russia;
exports.serbia = countries_2.serbia;
exports.slovakiaRepublic = countries_2.slovakiaRepublic;
exports.slovenia = countries_2.slovenia;
exports.spain = countries_2.spain;
exports.sweden = countries_2.sweden;
exports.switzerland = countries_2.switzerland;
exports.unitedKingdom = countries_2.unitedKingdom;
exports.checkVAT = jsvat_1.checkVAT;
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return countries_2.andorra; } });
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return countries_2.austria; } });
Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return countries_2.belgium; } });
Object.defineProperty(exports, "brazil", { enumerable: true, get: function () { return countries_2.brazil; } });
Object.defineProperty(exports, "bulgaria", { enumerable: true, get: function () { return countries_2.bulgaria; } });
Object.defineProperty(exports, "croatia", { enumerable: true, get: function () { return countries_2.croatia; } });
Object.defineProperty(exports, "cyprus", { enumerable: true, get: function () { return countries_2.cyprus; } });
Object.defineProperty(exports, "czechRepublic", { enumerable: true, get: function () { return countries_2.czechRepublic; } });
Object.defineProperty(exports, "denmark", { enumerable: true, get: function () { return countries_2.denmark; } });
Object.defineProperty(exports, "estonia", { enumerable: true, get: function () { return countries_2.estonia; } });
Object.defineProperty(exports, "europe", { enumerable: true, get: function () { return countries_2.europe; } });
Object.defineProperty(exports, "finland", { enumerable: true, get: function () { return countries_2.finland; } });
Object.defineProperty(exports, "france", { enumerable: true, get: function () { return countries_2.france; } });
Object.defineProperty(exports, "germany", { enumerable: true, get: function () { return countries_2.germany; } });
Object.defineProperty(exports, "greece", { enumerable: true, get: function () { return countries_2.greece; } });
Object.defineProperty(exports, "hungary", { enumerable: true, get: function () { return countries_2.hungary; } });
Object.defineProperty(exports, "ireland", { enumerable: true, get: function () { return countries_2.ireland; } });
Object.defineProperty(exports, "italy", { enumerable: true, get: function () { return countries_2.italy; } });
Object.defineProperty(exports, "latvia", { enumerable: true, get: function () { return countries_2.latvia; } });
Object.defineProperty(exports, "lithuania", { enumerable: true, get: function () { return countries_2.lithuania; } });
Object.defineProperty(exports, "luxembourg", { enumerable: true, get: function () { return countries_2.luxembourg; } });
Object.defineProperty(exports, "malta", { enumerable: true, get: function () { return countries_2.malta; } });
Object.defineProperty(exports, "netherlands", { enumerable: true, get: function () { return countries_2.netherlands; } });
Object.defineProperty(exports, "norway", { enumerable: true, get: function () { return countries_2.norway; } });
Object.defineProperty(exports, "poland", { enumerable: true, get: function () { return countries_2.poland; } });
Object.defineProperty(exports, "portugal", { enumerable: true, get: function () { return countries_2.portugal; } });
Object.defineProperty(exports, "romania", { enumerable: true, get: function () { return countries_2.romania; } });
Object.defineProperty(exports, "russia", { enumerable: true, get: function () { return countries_2.russia; } });
Object.defineProperty(exports, "serbia", { enumerable: true, get: function () { return countries_2.serbia; } });
Object.defineProperty(exports, "slovakiaRepublic", { enumerable: true, get: function () { return countries_2.slovakiaRepublic; } });
Object.defineProperty(exports, "slovenia", { enumerable: true, get: function () { return countries_2.slovenia; } });
Object.defineProperty(exports, "spain", { enumerable: true, get: function () { return countries_2.spain; } });
Object.defineProperty(exports, "sweden", { enumerable: true, get: function () { return countries_2.sweden; } });
Object.defineProperty(exports, "switzerland", { enumerable: true, get: function () { return countries_2.switzerland; } });
Object.defineProperty(exports, "unitedKingdom", { enumerable: true, get: function () { return countries_2.unitedKingdom; } });
Object.defineProperty(exports, "checkVAT", { enumerable: true, get: function () { return jsvat_1.checkVAT; } });
});
1 change: 1 addition & 0 deletions lib/amd/lib/countries/andorra.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.andorra = void 0;
exports.andorra = {
name: 'Andorra',
codes: ['AD', 'AND', '020'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/austria.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.austria = void 0;
exports.austria = {
name: 'Austria',
codes: ['AT', 'AUT', '040'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/belgium.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.belgium = void 0;
exports.belgium = {
name: 'Belgium',
codes: ['BE', 'BEL', '056'],
Expand Down
14 changes: 6 additions & 8 deletions lib/amd/lib/countries/brazil.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.brazil = void 0;
/**
* Generate check sums. Multiply numbers to validators and sum them to generate
* check sums, they're used to check if numbers are valid.
Expand All @@ -9,28 +10,25 @@ define(["require", "exports"], function (require, exports) {
*/
const generateCheckSums = (numbers, validators) => {
const initialCheckSums = [0, 0];
return validators.reduce(([checkerA, checkerB], validator, index) => [
(index === 0) ? 0 : (checkerA + numbers[index - 1] * validator),
checkerB + numbers[index] * validator
], initialCheckSums);
return validators.reduce(([checkerA, checkerB], validator, index) => [index === 0 ? 0 : checkerA + numbers[index - 1] * validator, checkerB + numbers[index] * validator], initialCheckSums);
};
const isRepeatedArray = (varNumbers) => varNumbers.every((varNumber) => varNumbers[0] === varNumber);
/**
* Get remaining of 11 or `0` if lower than 2.
* @param value - Value used remaining.
*/
const getRemaining = (value) => (value % 11) < 2 ? 0 : 11 - (value % 11);
const getRemaining = (value) => (value % 11 < 2 ? 0 : 11 - (value % 11));
exports.brazil = {
name: 'Brazil',
codes: ['BR', 'BRA', '076'],
calcFn: (vat) => {
const numbers = vat.split('').map(Number);
if (isRepeatedArray(numbers))
if (isRepeatedArray(numbers)) {
return false;
}
const validators = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
const checkers = generateCheckSums(numbers, validators);
return (numbers[12] === getRemaining(checkers[0]) &&
numbers[13] === getRemaining(checkers[1]));
return numbers[12] === getRemaining(checkers[0]) && numbers[13] === getRemaining(checkers[1]);
},
rules: {
multipliers: {},
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/bulgaria.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bulgaria = void 0;
exports.bulgaria = {
name: 'Bulgaria',
codes: ['BG', 'BGR', '100'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/croatiat.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.croatia = void 0;
exports.croatia = {
name: 'Croatia',
codes: ['HR', 'HRV', '191'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/cyprus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cyprus = void 0;
exports.cyprus = {
name: 'Cyprus',
codes: ['CY', 'CYP', '196'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/czechRepublic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.czechRepublic = void 0;
exports.czechRepublic = {
name: 'Czech Republic',
codes: ['CZ', 'CZE', '203'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/denmark.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.denmark = void 0;
exports.denmark = {
name: 'Denmark',
codes: ['DK', 'DNK', '208'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/estonia.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.estonia = void 0;
exports.estonia = {
name: 'Estonia',
codes: ['EE', 'EST', '233'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/europe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.europe = void 0;
exports.europe = {
name: 'Europe',
codes: ['EU', 'EUR', '000'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/finland.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.finland = void 0;
exports.finland = {
name: 'Finland',
codes: ['FI', 'FIN', '246'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/france.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.france = void 0;
exports.france = {
name: 'France',
codes: ['FR', 'FRA', '250'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/germany.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.germany = void 0;
exports.germany = {
name: 'Germany',
codes: ['DE', 'DEU', '276'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/greece.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.greece = void 0;
exports.greece = {
name: 'Greece',
codes: ['GR', 'GRC', '300'],
Expand Down
1 change: 1 addition & 0 deletions lib/amd/lib/countries/hungary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hungary = void 0;
exports.hungary = {
name: 'Hungary',
codes: ['HU', 'HUN', '348'],
Expand Down
Loading

0 comments on commit fd4250e

Please sign in to comment.