@thisisagile/easy-domain 17.20.7 → 17.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './values/DunsNumber';
16
16
  export * from './values/PostalCode';
17
17
  export * from './values/Slug';
18
18
  export * from './values/Url';
19
+ export * from './values/VAT';
package/dist/index.js CHANGED
@@ -6331,7 +6331,7 @@ var require_isVAT = __commonJS({
6331
6331
  Object.defineProperty(exports, "__esModule", {
6332
6332
  value: true
6333
6333
  });
6334
- exports.default = isVAT;
6334
+ exports.default = isVAT2;
6335
6335
  exports.vatMatchers = void 0;
6336
6336
  var _assertString = _interopRequireDefault(require_assertString());
6337
6337
  var algorithms = _interopRequireWildcard(require_algorithms());
@@ -6607,7 +6607,7 @@ var require_isVAT = __commonJS({
6607
6607
  return /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str);
6608
6608
  }
6609
6609
  };
6610
- function isVAT(str, countryCode) {
6610
+ function isVAT2(str, countryCode) {
6611
6611
  (0, _assertString.default)(str);
6612
6612
  (0, _assertString.default)(countryCode);
6613
6613
  if (countryCode in vatMatchers) {
@@ -6899,6 +6899,7 @@ __export(src_exports, {
6899
6899
  UnitOfMeasurement: () => UnitOfMeasurement,
6900
6900
  UnitOfWeight: () => UnitOfWeight,
6901
6901
  Url: () => Url,
6902
+ VAT: () => VAT,
6902
6903
  Weight: () => Weight,
6903
6904
  duns: () => duns,
6904
6905
  email: () => email,
@@ -6915,6 +6916,7 @@ __export(src_exports, {
6915
6916
  postalCode: () => postalCode,
6916
6917
  toSlug: () => toSlug,
6917
6918
  url: () => url,
6919
+ vat: () => vat,
6918
6920
  weight: () => weight
6919
6921
  });
6920
6922
  module.exports = __toCommonJS(src_exports);
@@ -8229,6 +8231,24 @@ var url = (url2, options) => new Url(url2, options);
8229
8231
  var isUrl = (url2, options) => {
8230
8232
  return !(0, import_easy18.isEmpty)(url2) && (0, import_validator7.isURL)((0, import_easy18.asString)(url2), options);
8231
8233
  };
8234
+
8235
+ // src/values/VAT.ts
8236
+ var import_easy19 = require("@thisisagile/easy");
8237
+ var import_validator8 = __toESM(require_validator());
8238
+ var VAT = class extends import_easy19.Value {
8239
+ country;
8240
+ constructor(vat2, country = "NL") {
8241
+ const cleaned = (0, import_easy19.text)(vat2).trim.replace(".", "").toString();
8242
+ super(cleaned);
8243
+ this.country = (0, import_easy19.text)(country).trim.upper.toString();
8244
+ }
8245
+ get isValid() {
8246
+ if (!(0, import_easy19.isNotEmpty)(this.value))
8247
+ return false;
8248
+ return (0, import_validator8.isVAT)(this.value, this.country);
8249
+ }
8250
+ };
8251
+ var vat = (v, country) => new VAT(v, country);
8232
8252
  // Annotate the CommonJS export names for ESM import in node:
8233
8253
  0 && (module.exports = {
8234
8254
  Address,
@@ -8248,6 +8268,7 @@ var isUrl = (url2, options) => {
8248
8268
  UnitOfMeasurement,
8249
8269
  UnitOfWeight,
8250
8270
  Url,
8271
+ VAT,
8251
8272
  Weight,
8252
8273
  duns,
8253
8274
  email,
@@ -8264,6 +8285,7 @@ var isUrl = (url2, options) => {
8264
8285
  postalCode,
8265
8286
  toSlug,
8266
8287
  url,
8288
+ vat,
8267
8289
  weight
8268
8290
  });
8269
8291
  //# sourceMappingURL=index.js.map