frontend/.pnpm-store/v3/files/8e/5dea3db2e53eb42dcc418be00fa6a5953dee93e1f3ef961b995b97ab9c8d456d46031253eddbb5149e039c92bf4ef270cf8337451a73612a1099b1fd33ae9a

14 lines
433 B
Plaintext

import assertString from './util/assertString';
export var vatMatchers = {
GB: /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/
};
export default function isVAT(str, countryCode) {
assertString(str);
assertString(countryCode);
if (countryCode in vatMatchers) {
return vatMatchers[countryCode].test(str);
}
throw new Error("Invalid country code: '".concat(countryCode, "'"));
}