Comparing version 3.0.0 to 3.0.1
@@ -8,5 +8,6 @@ define(["require", "exports"], function (require, exports) { | ||
codes: ['FR', 'FRA', '250'], | ||
calcFn: (vat) => { | ||
calcFn: (_vat) => { | ||
let total; | ||
// Checks the check digits of a French VAT number. | ||
// Remove optianal memberstate | ||
const vat = String(_vat).split('|||')[0]; | ||
if (!/^\d{11}$/.test(vat)) | ||
@@ -24,5 +25,11 @@ return true; | ||
multipliers: {}, | ||
regex: [/^(FR)(\d{11})$/, /^(FR)([A-HJ-NP-Z]\d{10})$/, /^(FR)(\d[A-HJ-NP-Z]\d{9})$/, /^(FR)([A-HJ-NP-Z]{2}\d{9})$/] | ||
regex: [ | ||
// (\|{3}[A-Z0-9]{2}[0-9]{9})? added for optional member state specification | ||
/^(FR)(\d{11})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]\d{10})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)(\d[A-HJ-NP-Z]\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
] | ||
} | ||
}; | ||
}); |
@@ -7,3 +7,3 @@ define(["require", "exports"], function (require, exports) { | ||
name: 'United Kingdom', | ||
codes: ['GB', 'GBR', '826'], | ||
codes: ['GB', 'GBR', '826', 'XI'], | ||
calcFn: (vat) => { | ||
@@ -23,3 +23,8 @@ // Government departments | ||
}, | ||
regex: [/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, /^(GB)?(GD\d{3})$/, /^(GB)?(HA\d{3})$/] | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(GB)?(GD\d{3})$/, | ||
/^(GB)?(HA\d{3})$/, | ||
] | ||
} | ||
@@ -36,2 +41,3 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -38,0 +44,0 @@ // 0 VAT numbers disallowed! |
@@ -7,5 +7,6 @@ "use strict"; | ||
codes: ['FR', 'FRA', '250'], | ||
calcFn: function (vat) { | ||
calcFn: function (_vat) { | ||
var total; | ||
// Checks the check digits of a French VAT number. | ||
// Remove optianal memberstate | ||
var vat = String(_vat).split('|||')[0]; | ||
if (!/^\d{11}$/.test(vat)) | ||
@@ -23,4 +24,10 @@ return true; | ||
multipliers: {}, | ||
regex: [/^(FR)(\d{11})$/, /^(FR)([A-HJ-NP-Z]\d{10})$/, /^(FR)(\d[A-HJ-NP-Z]\d{9})$/, /^(FR)([A-HJ-NP-Z]{2}\d{9})$/] | ||
regex: [ | ||
// (\|{3}[A-Z0-9]{2}[0-9]{9})? added for optional member state specification | ||
/^(FR)(\d{11})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]\d{10})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)(\d[A-HJ-NP-Z]\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
] | ||
} | ||
}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
name: 'United Kingdom', | ||
codes: ['GB', 'GBR', '826'], | ||
codes: ['GB', 'GBR', '826', 'XI'], | ||
calcFn: function (vat) { | ||
@@ -22,3 +22,8 @@ // Government departments | ||
}, | ||
regex: [/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, /^(GB)?(GD\d{3})$/, /^(GB)?(HA\d{3})$/] | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(GB)?(GD\d{3})$/, | ||
/^(GB)?(HA\d{3})$/, | ||
] | ||
} | ||
@@ -35,2 +40,3 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
var total = 0; | ||
@@ -37,0 +43,0 @@ // 0 VAT numbers disallowed! |
export const france = { | ||
name: 'France', | ||
codes: ['FR', 'FRA', '250'], | ||
calcFn: (vat) => { | ||
calcFn: (_vat) => { | ||
let total; | ||
// Checks the check digits of a French VAT number. | ||
// Remove optianal memberstate | ||
const vat = String(_vat).split('|||')[0]; | ||
if (!/^\d{11}$/.test(vat)) | ||
@@ -19,4 +20,10 @@ return true; | ||
multipliers: {}, | ||
regex: [/^(FR)(\d{11})$/, /^(FR)([A-HJ-NP-Z]\d{10})$/, /^(FR)(\d[A-HJ-NP-Z]\d{9})$/, /^(FR)([A-HJ-NP-Z]{2}\d{9})$/] | ||
regex: [ | ||
// (\|{3}[A-Z0-9]{2}[0-9]{9})? added for optional member state specification | ||
/^(FR)(\d{11})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]\d{10})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)(\d[A-HJ-NP-Z]\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
] | ||
} | ||
}; |
export const unitedKingdom = { | ||
name: 'United Kingdom', | ||
codes: ['GB', 'GBR', '826'], | ||
codes: ['GB', 'GBR', '826', 'XI'], | ||
calcFn: (vat) => { | ||
@@ -18,3 +18,8 @@ // Government departments | ||
}, | ||
regex: [/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, /^(GB)?(GD\d{3})$/, /^(GB)?(HA\d{3})$/] | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(GB)?(GD\d{3})$/, | ||
/^(GB)?(HA\d{3})$/, | ||
] | ||
} | ||
@@ -31,2 +36,3 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -33,0 +39,0 @@ // 0 VAT numbers disallowed! |
@@ -11,5 +11,6 @@ System.register([], function (exports_1, context_1) { | ||
codes: ['FR', 'FRA', '250'], | ||
calcFn: (vat) => { | ||
calcFn: (_vat) => { | ||
let total; | ||
// Checks the check digits of a French VAT number. | ||
// Remove optianal memberstate | ||
const vat = String(_vat).split('|||')[0]; | ||
if (!/^\d{11}$/.test(vat)) | ||
@@ -27,3 +28,9 @@ return true; | ||
multipliers: {}, | ||
regex: [/^(FR)(\d{11})$/, /^(FR)([A-HJ-NP-Z]\d{10})$/, /^(FR)(\d[A-HJ-NP-Z]\d{9})$/, /^(FR)([A-HJ-NP-Z]{2}\d{9})$/] | ||
regex: [ | ||
// (\|{3}[A-Z0-9]{2}[0-9]{9})? added for optional member state specification | ||
/^(FR)(\d{11})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]\d{10})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)(\d[A-HJ-NP-Z]\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
] | ||
} | ||
@@ -30,0 +37,0 @@ }); |
@@ -14,2 +14,3 @@ System.register([], function (exports_1, context_1) { | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -57,3 +58,3 @@ // 0 VAT numbers disallowed! | ||
name: 'United Kingdom', | ||
codes: ['GB', 'GBR', '826'], | ||
codes: ['GB', 'GBR', '826', 'XI'], | ||
calcFn: (vat) => { | ||
@@ -73,3 +74,8 @@ // Government departments | ||
}, | ||
regex: [/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, /^(GB)?(GD\d{3})$/, /^(GB)?(HA\d{3})$/] | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(GB)?(GD\d{3})$/, | ||
/^(GB)?(HA\d{3})$/, | ||
] | ||
} | ||
@@ -76,0 +82,0 @@ }); |
@@ -16,5 +16,6 @@ (function (factory) { | ||
codes: ['FR', 'FRA', '250'], | ||
calcFn: (vat) => { | ||
calcFn: (_vat) => { | ||
let total; | ||
// Checks the check digits of a French VAT number. | ||
// Remove optianal memberstate | ||
const vat = String(_vat).split('|||')[0]; | ||
if (!/^\d{11}$/.test(vat)) | ||
@@ -32,5 +33,11 @@ return true; | ||
multipliers: {}, | ||
regex: [/^(FR)(\d{11})$/, /^(FR)([A-HJ-NP-Z]\d{10})$/, /^(FR)(\d[A-HJ-NP-Z]\d{9})$/, /^(FR)([A-HJ-NP-Z]{2}\d{9})$/] | ||
regex: [ | ||
// (\|{3}[A-Z0-9]{2}[0-9]{9})? added for optional member state specification | ||
/^(FR)(\d{11})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]\d{10})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)(\d[A-HJ-NP-Z]\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/, | ||
] | ||
} | ||
}; | ||
}); |
@@ -15,3 +15,3 @@ (function (factory) { | ||
name: 'United Kingdom', | ||
codes: ['GB', 'GBR', '826'], | ||
codes: ['GB', 'GBR', '826', 'XI'], | ||
calcFn: (vat) => { | ||
@@ -31,3 +31,8 @@ // Government departments | ||
}, | ||
regex: [/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, /^(GB)?(GD\d{3})$/, /^(GB)?(HA\d{3})$/] | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(GB)?(GD\d{3})$/, | ||
/^(GB)?(HA\d{3})$/, | ||
] | ||
} | ||
@@ -44,2 +49,3 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -46,0 +52,0 @@ // 0 VAT numbers disallowed! |
{ | ||
"name": "jsvat-next", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Check the validity of the format of an EU VAT number", | ||
@@ -34,3 +34,2 @@ "main": "./lib/commonjs/index.js", | ||
}, | ||
"homepage": "https://se-panfilov.github.io/jsvat/", | ||
"keywords": [ | ||
@@ -37,0 +36,0 @@ "jsvat", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
357953
236
8912
1