Comparing version 3.0.1 to 3.0.2
export { andorra } from './lib/es6/lib/countries/andorra'; | ||
export { australia } from './lib/es6/lib/countries/australia'; | ||
export { austria } from './lib/es6/lib/countries/austria'; | ||
@@ -3,0 +4,0 @@ export { belgium } from './lib/es6/lib/countries/belgium'; |
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.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.australia = exports.andorra = exports.countries = void 0; | ||
exports.countries = [ | ||
countries_1.andorra, | ||
countries_1.australia, | ||
countries_1.austria, | ||
@@ -43,2 +44,3 @@ countries_1.belgium, | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return countries_2.andorra; } }); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return countries_2.australia; } }); | ||
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return countries_2.austria; } }); | ||
@@ -45,0 +47,0 @@ Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return countries_2.belgium; } }); |
@@ -8,12 +8,13 @@ define(["require", "exports"], function (require, exports) { | ||
codes: ['BE', 'BEL', '056'], | ||
calcFn: (vat) => { | ||
const newVat = vat.length === 9 ? '0' + vat : vat; | ||
const check = 97 - (Number(newVat.slice(0, 8)) % 97); | ||
return check === Number(newVat.slice(8, 10)); | ||
calcFn: (_vat) => { | ||
const vat = String(_vat).replace('BE', ''); | ||
const check = 97 - (Number(vat.slice(0, 8)) % 97); | ||
return check === Number(vat.slice(8, 10)); | ||
}, | ||
rules: { | ||
multipliers: {}, | ||
regex: [/^(BE)([0-1]?\d{9})$/] | ||
regex: [/^(BE){1}([0-1]{1}\d{9})$/] | ||
// regex: [/^(BE){0,1}([0-1]{1}\d{9})$/] // BE: Optional Country Code | ||
} | ||
}; | ||
}); |
@@ -29,3 +29,3 @@ define(["require", "exports"], function (require, exports) { | ||
/^(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})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/ | ||
] | ||
@@ -32,0 +32,0 @@ } |
@@ -1,6 +0,7 @@ | ||
define(["require", "exports", "./andorra", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], function (require, exports, andorra_1, austria_1, belgium_1, brazil_1, bulgaria_1, croatiat_1, cyprus_1, czechRepublic_1, denmark_1, estonia_1, europe_1, finland_1, france_1, germany_1, greece_1, hungary_1, ireland_1, italy_1, latvia_1, lithuania_1, luxembourg_1, malta_1, netherlands_1, norway_1, poland_1, portugal_1, romania_1, russia_1, serbia_1, slovakiaRepublic_1, slovenia_1, spain_1, sweden_1, switzerland_1, unitedKingdom_1) { | ||
define(["require", "exports", "./andorra", "./australia", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], function (require, exports, andorra_1, australia_1, austria_1, belgium_1, brazil_1, bulgaria_1, croatiat_1, cyprus_1, czechRepublic_1, denmark_1, estonia_1, europe_1, finland_1, france_1, germany_1, greece_1, hungary_1, ireland_1, italy_1, latvia_1, lithuania_1, luxembourg_1, malta_1, netherlands_1, norway_1, poland_1, portugal_1, romania_1, russia_1, serbia_1, slovakiaRepublic_1, slovenia_1, spain_1, sweden_1, switzerland_1, unitedKingdom_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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.australia = exports.andorra = void 0; | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return andorra_1.andorra; } }); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return australia_1.australia; } }); | ||
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return austria_1.austria; } }); | ||
@@ -7,0 +8,0 @@ Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return belgium_1.belgium; } }); |
@@ -22,8 +22,3 @@ define(["require", "exports"], function (require, exports) { | ||
}, | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(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})$/] | ||
} | ||
@@ -40,3 +35,2 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -43,0 +37,0 @@ // 0 VAT numbers disallowed! |
@@ -32,3 +32,8 @@ define(["require", "exports", "./countries"], function (require, exports, countries_1) { | ||
} | ||
const countriesVATDoesNotStartWithCountryCode = [countries_1.brazil.name, countries_1.norway.name]; | ||
const countriesVATDoesNotStartWithCountryCode = [ | ||
countries_1.australia.name, | ||
// belgium.name, // BE: Optional Country Code disabled | ||
countries_1.brazil.name, | ||
countries_1.norway.name | ||
]; | ||
function isVATStartWithCountryCode(countryName) { | ||
@@ -35,0 +40,0 @@ return !countriesVATDoesNotStartWithCountryCode.includes(countryName); |
"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.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.australia = exports.andorra = exports.countries = void 0; | ||
var countries_1 = require("./lib/countries"); | ||
exports.countries = [ | ||
countries_1.andorra, | ||
countries_1.australia, | ||
countries_1.austria, | ||
@@ -44,2 +45,3 @@ countries_1.belgium, | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return countries_2.andorra; } }); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return countries_2.australia; } }); | ||
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return countries_2.austria; } }); | ||
@@ -46,0 +48,0 @@ Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return countries_2.belgium; } }); |
@@ -7,11 +7,12 @@ "use strict"; | ||
codes: ['BE', 'BEL', '056'], | ||
calcFn: function (vat) { | ||
var newVat = vat.length === 9 ? '0' + vat : vat; | ||
var check = 97 - (Number(newVat.slice(0, 8)) % 97); | ||
return check === Number(newVat.slice(8, 10)); | ||
calcFn: function (_vat) { | ||
var vat = String(_vat).replace('BE', ''); | ||
var check = 97 - (Number(vat.slice(0, 8)) % 97); | ||
return check === Number(vat.slice(8, 10)); | ||
}, | ||
rules: { | ||
multipliers: {}, | ||
regex: [/^(BE)([0-1]?\d{9})$/] | ||
regex: [/^(BE){1}([0-1]{1}\d{9})$/] | ||
// regex: [/^(BE){0,1}([0-1]{1}\d{9})$/] // BE: Optional Country Code | ||
} | ||
}; |
@@ -28,5 +28,5 @@ "use strict"; | ||
/^(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})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/ | ||
] | ||
} | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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.australia = exports.andorra = void 0; | ||
var andorra_1 = require("./andorra"); | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return andorra_1.andorra; } }); | ||
var australia_1 = require("./australia"); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return australia_1.australia; } }); | ||
var austria_1 = require("./austria"); | ||
@@ -7,0 +9,0 @@ Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return austria_1.austria; } }); |
@@ -21,8 +21,3 @@ "use strict"; | ||
}, | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(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})$/] | ||
} | ||
@@ -39,3 +34,2 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
var total = 0; | ||
@@ -42,0 +36,0 @@ // 0 VAT numbers disallowed! |
@@ -49,3 +49,8 @@ "use strict"; | ||
} | ||
var countriesVATDoesNotStartWithCountryCode = [countries_1.brazil.name, countries_1.norway.name]; | ||
var countriesVATDoesNotStartWithCountryCode = [ | ||
countries_1.australia.name, | ||
// belgium.name, // BE: Optional Country Code disabled | ||
countries_1.brazil.name, | ||
countries_1.norway.name | ||
]; | ||
function isVATStartWithCountryCode(countryName) { | ||
@@ -52,0 +57,0 @@ return !countriesVATDoesNotStartWithCountryCode.includes(countryName); |
@@ -1,4 +0,5 @@ | ||
import { 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 './lib/countries'; | ||
import { andorra, australia, 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 './lib/countries'; | ||
export const countries = [ | ||
andorra, | ||
australia, | ||
austria, | ||
@@ -39,3 +40,3 @@ belgium, | ||
]; | ||
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 } from './lib/countries'; | ||
export { andorra, australia, 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 './lib/countries'; | ||
export { checkVAT } from './lib/jsvat'; |
export const belgium = { | ||
name: 'Belgium', | ||
codes: ['BE', 'BEL', '056'], | ||
calcFn: (vat) => { | ||
const newVat = vat.length === 9 ? '0' + vat : vat; | ||
const check = 97 - (Number(newVat.slice(0, 8)) % 97); | ||
return check === Number(newVat.slice(8, 10)); | ||
calcFn: (_vat) => { | ||
const vat = String(_vat).replace('BE', ''); | ||
const check = 97 - (Number(vat.slice(0, 8)) % 97); | ||
return check === Number(vat.slice(8, 10)); | ||
}, | ||
rules: { | ||
multipliers: {}, | ||
regex: [/^(BE)([0-1]?\d{9})$/] | ||
regex: [/^(BE){1}([0-1]{1}\d{9})$/] | ||
// regex: [/^(BE){0,1}([0-1]{1}\d{9})$/] // BE: Optional Country Code | ||
} | ||
}; |
@@ -25,5 +25,5 @@ export const france = { | ||
/^(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})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/ | ||
] | ||
} | ||
}; |
export { andorra } from './andorra'; | ||
export { australia } from './australia'; | ||
export { austria } from './austria'; | ||
@@ -3,0 +4,0 @@ export { belgium } from './belgium'; |
@@ -18,8 +18,3 @@ export const unitedKingdom = { | ||
}, | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(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,3 +31,2 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -39,0 +33,0 @@ // 0 VAT numbers disallowed! |
@@ -1,2 +0,2 @@ | ||
import { brazil, norway } from './countries'; | ||
import { australia, brazil, norway } from './countries'; | ||
function makeResult(vat, isValid, country) { | ||
@@ -29,3 +29,8 @@ return { | ||
} | ||
const countriesVATDoesNotStartWithCountryCode = [brazil.name, norway.name]; | ||
const countriesVATDoesNotStartWithCountryCode = [ | ||
australia.name, | ||
// belgium.name, // BE: Optional Country Code disabled | ||
brazil.name, | ||
norway.name | ||
]; | ||
function isVATStartWithCountryCode(countryName) { | ||
@@ -32,0 +37,0 @@ return !countriesVATDoesNotStartWithCountryCode.includes(countryName); |
@@ -11,2 +11,3 @@ System.register(["./lib/countries", "./lib/jsvat"], function (exports_1, context_1) { | ||
"andorra": countries_1_1["andorra"], | ||
"australia": countries_1_1["australia"], | ||
"austria": countries_1_1["austria"], | ||
@@ -57,2 +58,3 @@ "belgium": countries_1_1["belgium"], | ||
countries_1.andorra, | ||
countries_1.australia, | ||
countries_1.austria, | ||
@@ -59,0 +61,0 @@ countries_1.belgium, |
@@ -11,10 +11,11 @@ System.register([], function (exports_1, context_1) { | ||
codes: ['BE', 'BEL', '056'], | ||
calcFn: (vat) => { | ||
const newVat = vat.length === 9 ? '0' + vat : vat; | ||
const check = 97 - (Number(newVat.slice(0, 8)) % 97); | ||
return check === Number(newVat.slice(8, 10)); | ||
calcFn: (_vat) => { | ||
const vat = String(_vat).replace('BE', ''); | ||
const check = 97 - (Number(vat.slice(0, 8)) % 97); | ||
return check === Number(vat.slice(8, 10)); | ||
}, | ||
rules: { | ||
multipliers: {}, | ||
regex: [/^(BE)([0-1]?\d{9})$/] | ||
regex: [/^(BE){1}([0-1]{1}\d{9})$/] | ||
// regex: [/^(BE){0,1}([0-1]{1}\d{9})$/] // BE: Optional Country Code | ||
} | ||
@@ -21,0 +22,0 @@ }); |
@@ -32,3 +32,3 @@ System.register([], function (exports_1, context_1) { | ||
/^(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})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/ | ||
] | ||
@@ -35,0 +35,0 @@ } |
@@ -1,2 +0,2 @@ | ||
System.register(["./andorra", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], function (exports_1, context_1) { | ||
System.register(["./andorra", "./australia", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], function (exports_1, context_1) { | ||
"use strict"; | ||
@@ -11,2 +11,7 @@ var __moduleName = context_1 && context_1.id; | ||
}, | ||
function (australia_1_1) { | ||
exports_1({ | ||
"australia": australia_1_1["australia"] | ||
}); | ||
}, | ||
function (austria_1_1) { | ||
@@ -13,0 +18,0 @@ exports_1({ |
@@ -14,3 +14,2 @@ System.register([], function (exports_1, context_1) { | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -73,8 +72,3 @@ // 0 VAT numbers disallowed! | ||
}, | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(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})$/] | ||
} | ||
@@ -81,0 +75,0 @@ }); |
@@ -83,5 +83,10 @@ System.register(["./countries"], function (exports_1, context_1) { | ||
execute: function () { | ||
countriesVATDoesNotStartWithCountryCode = [countries_1.brazil.name, countries_1.norway.name]; | ||
countriesVATDoesNotStartWithCountryCode = [ | ||
countries_1.australia.name, | ||
// belgium.name, // BE: Optional Country Code disabled | ||
countries_1.brazil.name, | ||
countries_1.norway.name | ||
]; | ||
} | ||
}; | ||
}); |
@@ -12,6 +12,7 @@ (function (factory) { | ||
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.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.australia = exports.andorra = exports.countries = void 0; | ||
const countries_1 = require("./lib/countries"); | ||
exports.countries = [ | ||
countries_1.andorra, | ||
countries_1.australia, | ||
countries_1.austria, | ||
@@ -54,2 +55,3 @@ countries_1.belgium, | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return countries_2.andorra; } }); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return countries_2.australia; } }); | ||
Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return countries_2.austria; } }); | ||
@@ -56,0 +58,0 @@ Object.defineProperty(exports, "belgium", { enumerable: true, get: function () { return countries_2.belgium; } }); |
@@ -16,12 +16,13 @@ (function (factory) { | ||
codes: ['BE', 'BEL', '056'], | ||
calcFn: (vat) => { | ||
const newVat = vat.length === 9 ? '0' + vat : vat; | ||
const check = 97 - (Number(newVat.slice(0, 8)) % 97); | ||
return check === Number(newVat.slice(8, 10)); | ||
calcFn: (_vat) => { | ||
const vat = String(_vat).replace('BE', ''); | ||
const check = 97 - (Number(vat.slice(0, 8)) % 97); | ||
return check === Number(vat.slice(8, 10)); | ||
}, | ||
rules: { | ||
multipliers: {}, | ||
regex: [/^(BE)([0-1]?\d{9})$/] | ||
regex: [/^(BE){1}([0-1]{1}\d{9})$/] | ||
// regex: [/^(BE){0,1}([0-1]{1}\d{9})$/] // BE: Optional Country Code | ||
} | ||
}; | ||
}); |
@@ -37,3 +37,3 @@ (function (factory) { | ||
/^(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})?$/, | ||
/^(FR)([A-HJ-NP-Z]{2}\d{9})(\|{3}[A-Z0-9]{2}[0-9]{9})?$/ | ||
] | ||
@@ -40,0 +40,0 @@ } |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./andorra", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], factory); | ||
define(["require", "exports", "./andorra", "./australia", "./austria", "./belgium", "./brazil", "./bulgaria", "./croatiat", "./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"], factory); | ||
} | ||
@@ -13,5 +13,7 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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.australia = exports.andorra = void 0; | ||
var andorra_1 = require("./andorra"); | ||
Object.defineProperty(exports, "andorra", { enumerable: true, get: function () { return andorra_1.andorra; } }); | ||
var australia_1 = require("./australia"); | ||
Object.defineProperty(exports, "australia", { enumerable: true, get: function () { return australia_1.australia; } }); | ||
var austria_1 = require("./austria"); | ||
@@ -18,0 +20,0 @@ Object.defineProperty(exports, "austria", { enumerable: true, get: function () { return austria_1.austria; } }); |
@@ -30,8 +30,3 @@ (function (factory) { | ||
}, | ||
regex: [ | ||
/^(GB)?(\d{9})$/, /^(GB)?(\d{12})$/, | ||
/^(XI)?(\d{9})$/, | ||
/^(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})$/] | ||
} | ||
@@ -48,3 +43,2 @@ }; | ||
function isStandardOrCommercialNumber(vat, multipliers) { | ||
console.log('isStandardOrCommercialNumber', vat); | ||
let total = 0; | ||
@@ -51,0 +45,0 @@ // 0 VAT numbers disallowed! |
@@ -41,3 +41,8 @@ (function (factory) { | ||
} | ||
const countriesVATDoesNotStartWithCountryCode = [countries_1.brazil.name, countries_1.norway.name]; | ||
const countriesVATDoesNotStartWithCountryCode = [ | ||
countries_1.australia.name, | ||
// belgium.name, // BE: Optional Country Code disabled | ||
countries_1.brazil.name, | ||
countries_1.norway.name | ||
]; | ||
function isVATStartWithCountryCode(countryName) { | ||
@@ -44,0 +49,0 @@ return !countriesVATDoesNotStartWithCountryCode.includes(countryName); |
{ | ||
"name": "jsvat-next", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Check the validity of the format of an EU VAT number", | ||
@@ -5,0 +5,0 @@ "main": "./lib/commonjs/index.js", |
import { Country } from './lib/jsvat'; | ||
export declare const countries: ReadonlyArray<Country>; | ||
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 } from './lib/countries'; | ||
export { andorra, australia, 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 './lib/countries'; | ||
export { checkVAT, Rules, Country, Multipliers, VatCheckResult } from './lib/jsvat'; |
export { andorra } from './andorra'; | ||
export { australia } from './australia'; | ||
export { austria } from './austria'; | ||
@@ -3,0 +4,0 @@ export { belgium } from './belgium'; |
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
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
366095
243
9093