@thisisagile/easy-domain 17.17.2 → 17.18.1

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
@@ -12,6 +12,7 @@ export * from './structs/Weight';
12
12
  export * from './values/EAN';
13
13
  export * from './values/Email';
14
14
  export * from './values/IBAN';
15
+ export * from './values/DunsNumber';
15
16
  export * from './values/PostalCode';
16
17
  export * from './values/Slug';
17
18
  export * from './values/Url';
package/dist/index.js CHANGED
@@ -1472,14 +1472,14 @@ var require_isNumeric = __commonJS({
1472
1472
  Object.defineProperty(exports, "__esModule", {
1473
1473
  value: true
1474
1474
  });
1475
- exports.default = isNumeric;
1475
+ exports.default = isNumeric2;
1476
1476
  var _assertString = _interopRequireDefault(require_assertString());
1477
1477
  var _alpha = require_alpha();
1478
1478
  function _interopRequireDefault(obj) {
1479
1479
  return obj && obj.__esModule ? obj : { default: obj };
1480
1480
  }
1481
1481
  var numericNoSymbols = /^[0-9]+$/;
1482
- function isNumeric(str, options) {
1482
+ function isNumeric2(str, options) {
1483
1483
  (0, _assertString.default)(str);
1484
1484
  if (options && options.no_symbols) {
1485
1485
  return numericNoSymbols.test(str);
@@ -2545,7 +2545,7 @@ var require_isEmpty = __commonJS({
2545
2545
  Object.defineProperty(exports, "__esModule", {
2546
2546
  value: true
2547
2547
  });
2548
- exports.default = isEmpty7;
2548
+ exports.default = isEmpty8;
2549
2549
  var _assertString = _interopRequireDefault(require_assertString());
2550
2550
  var _merge = _interopRequireDefault(require_merge());
2551
2551
  function _interopRequireDefault(obj) {
@@ -2554,7 +2554,7 @@ var require_isEmpty = __commonJS({
2554
2554
  var default_is_empty_options = {
2555
2555
  ignore_whitespace: false
2556
2556
  };
2557
- function isEmpty7(str, options) {
2557
+ function isEmpty8(str, options) {
2558
2558
  (0, _assertString.default)(str);
2559
2559
  options = (0, _merge.default)(options, default_is_empty_options);
2560
2560
  return (options.ignore_whitespace ? str.trim().length : str.length) === 0;
@@ -2571,7 +2571,7 @@ var require_isLength = __commonJS({
2571
2571
  Object.defineProperty(exports, "__esModule", {
2572
2572
  value: true
2573
2573
  });
2574
- exports.default = isLength;
2574
+ exports.default = isLength2;
2575
2575
  var _assertString = _interopRequireDefault(require_assertString());
2576
2576
  function _interopRequireDefault(obj) {
2577
2577
  return obj && obj.__esModule ? obj : { default: obj };
@@ -2584,7 +2584,7 @@ var require_isLength = __commonJS({
2584
2584
  return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
2585
2585
  }, _typeof(o);
2586
2586
  }
2587
- function isLength(str, options) {
2587
+ function isLength2(str, options) {
2588
2588
  (0, _assertString.default)(str);
2589
2589
  var min;
2590
2590
  var max;
@@ -6673,6 +6673,7 @@ __export(src_exports, {
6673
6673
  Country: () => Country,
6674
6674
  Currency: () => Currency,
6675
6675
  Dimension: () => Dimension,
6676
+ DunsNumber: () => DunsNumber,
6676
6677
  EAN: () => EAN,
6677
6678
  Email: () => Email,
6678
6679
  IBAN: () => IBAN,
@@ -6685,8 +6686,10 @@ __export(src_exports, {
6685
6686
  UnitOfWeight: () => UnitOfWeight,
6686
6687
  Url: () => Url,
6687
6688
  Weight: () => Weight,
6689
+ duns: () => duns,
6688
6690
  email: () => email,
6689
6691
  isAddress: () => isAddress,
6692
+ isDunsNumber: () => isDunsNumber,
6690
6693
  isEAN: () => isEAN,
6691
6694
  isEmail: () => isEmail,
6692
6695
  isIBAN: () => isIBAN,
@@ -7932,25 +7935,39 @@ var isIBAN = (iban) => {
7932
7935
  return !(0, import_easy15.isEmpty)(iban) && (0, import_validator4.isIBAN)((0, import_easy15.asString)(iban));
7933
7936
  };
7934
7937
 
7935
- // src/values/Slug.ts
7938
+ // src/values/DunsNumber.ts
7936
7939
  var import_easy16 = require("@thisisagile/easy");
7937
7940
  var import_validator5 = __toESM(require_validator());
7938
- var Slug = class extends import_easy16.Value {
7941
+ var DunsNumber = class extends import_easy16.Value {
7942
+ constructor(duns2) {
7943
+ super((0, import_easy16.asString)(duns2).trim());
7944
+ }
7945
+ get isValid() {
7946
+ return isDunsNumber(this.value);
7947
+ }
7948
+ };
7949
+ var duns = (d) => new DunsNumber(d);
7950
+ var isDunsNumber = (d) => !(0, import_easy16.isEmpty)(d) && (0, import_validator5.isNumeric)(d, { no_symbols: true }) && (0, import_validator5.isLength)(d, { min: 9, max: 9 });
7951
+
7952
+ // src/values/Slug.ts
7953
+ var import_easy17 = require("@thisisagile/easy");
7954
+ var import_validator6 = __toESM(require_validator());
7955
+ var Slug = class extends import_easy17.Value {
7939
7956
  constructor(slug) {
7940
- super((0, import_easy16.text)(slug).slug.toString());
7957
+ super((0, import_easy17.text)(slug).slug.toString());
7941
7958
  }
7942
7959
  get isValid() {
7943
- return (0, import_easy16.isNotEmpty)(this.value) && (0, import_validator5.isSlug)(this.value);
7960
+ return (0, import_easy17.isNotEmpty)(this.value) && (0, import_validator6.isSlug)(this.value);
7944
7961
  }
7945
7962
  };
7946
7963
  var toSlug = (slug) => new Slug(slug);
7947
7964
 
7948
7965
  // src/values/Url.ts
7949
- var import_validator6 = __toESM(require_validator());
7950
- var import_easy17 = require("@thisisagile/easy");
7951
- var Url = class extends import_easy17.Value {
7966
+ var import_validator7 = __toESM(require_validator());
7967
+ var import_easy18 = require("@thisisagile/easy");
7968
+ var Url = class extends import_easy18.Value {
7952
7969
  constructor(value, options) {
7953
- super((0, import_easy17.asString)(value));
7970
+ super((0, import_easy18.asString)(value));
7954
7971
  this.options = options;
7955
7972
  }
7956
7973
  get isValid() {
@@ -7959,7 +7976,7 @@ var Url = class extends import_easy17.Value {
7959
7976
  };
7960
7977
  var url = (url2, options) => new Url(url2, options);
7961
7978
  var isUrl = (url2, options) => {
7962
- return !(0, import_easy17.isEmpty)(url2) && (0, import_validator6.isURL)((0, import_easy17.asString)(url2), options);
7979
+ return !(0, import_easy18.isEmpty)(url2) && (0, import_validator7.isURL)((0, import_easy18.asString)(url2), options);
7963
7980
  };
7964
7981
  // Annotate the CommonJS export names for ESM import in node:
7965
7982
  0 && (module.exports = {
@@ -7968,6 +7985,7 @@ var isUrl = (url2, options) => {
7968
7985
  Country,
7969
7986
  Currency,
7970
7987
  Dimension,
7988
+ DunsNumber,
7971
7989
  EAN,
7972
7990
  Email,
7973
7991
  IBAN,
@@ -7980,8 +7998,10 @@ var isUrl = (url2, options) => {
7980
7998
  UnitOfWeight,
7981
7999
  Url,
7982
8000
  Weight,
8001
+ duns,
7983
8002
  email,
7984
8003
  isAddress,
8004
+ isDunsNumber,
7985
8005
  isEAN,
7986
8006
  isEmail,
7987
8007
  isIBAN,