xdbc 1.0.102 → 1.0.104

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.
@@ -15,7 +15,7 @@ export class DEFINED extends DBC {
15
15
  static checkAlgorithm(toCheck) {
16
16
  // biome-ignore lint/suspicious/useValidTypeof: Necessary
17
17
  if (toCheck === undefined || toCheck === null) {
18
- return `Value may not be UNDEFINED or NULL`;
18
+ return `Value may not be UNDEFINED or NULL but it is ${toCheck === undefined ? "UNDEFINED" : "NULL"}`;
19
19
  }
20
20
  return true;
21
21
  }
@@ -74,6 +74,23 @@ export class DEFINED extends DBC {
74
74
  check(toCheck) {
75
75
  return DEFINED.checkAlgorithm(toCheck);
76
76
  }
77
+ /**
78
+ * Invokes the {@link DEFINED.checkAlgorithm } passing the value **toCheck** and the {@link DEFINED.type } .
79
+ *
80
+ * @param toCheck See {@link DEFINED.checkAlgorithm }.
81
+ *
82
+ * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link DEFINED }.
83
+ *
84
+ * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }.*/
85
+ static tsCheck(toCheck) {
86
+ const result = DEFINED.checkAlgorithm(toCheck);
87
+ if (result) {
88
+ return toCheck;
89
+ }
90
+ else {
91
+ throw new DBC.Infringement(result);
92
+ }
93
+ }
77
94
  /** Creates this {@link DEFINED }. */
78
95
  constructor() {
79
96
  super();
@@ -82,10 +82,13 @@ export class INSTANCE extends DBC {
82
82
  return INSTANCE.checkAlgorithm(toCheck, this.reference);
83
83
  }
84
84
  /**
85
+ * Invokes the {@link INSTANCE.checkAlgorithm } passing the value **toCheck** and the {@link INSTANCE.reference } .
86
+ *
87
+ * @param See {@link INSTANCE.checkAlgorithm }.
88
+ *
89
+ * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link INSTANCE }.
85
90
  *
86
- * @param toCheck
87
- * @returns
88
- */
91
+ * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }. */
89
92
  tsCheck(toCheck) {
90
93
  const result = INSTANCE.checkAlgorithm(toCheck, this.reference);
91
94
  if (result) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.102",
2
+ "version": "1.0.104",
3
3
  "name": "xdbc",
4
4
  "scripts": {
5
5
  "docs": "typedoc",
@@ -4,7 +4,7 @@ import { DBC } from "../DBC";
4
4
  *
5
5
  * @remarks
6
6
  * Maintainer: Salvatore Callari (XDBC@WaXCode.net) */
7
- export class DEFINED < CANDIDATE = any > extends DBC {
7
+ export class DEFINED extends DBC {
8
8
  /**
9
9
  * Checks if the value **toCheck** is null or undefined.
10
10
  *
@@ -108,11 +108,14 @@ export class DEFINED < CANDIDATE = any > extends DBC {
108
108
  return DEFINED.checkAlgorithm(toCheck);
109
109
  }
110
110
  /**
111
+ * Invokes the {@link DEFINED.checkAlgorithm } passing the value **toCheck** and the {@link DEFINED.type } .
112
+ *
113
+ * @param toCheck See {@link DEFINED.checkAlgorithm }.
114
+ *
115
+ * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link DEFINED }.
111
116
  *
112
- * @param toCheck
113
- * @returns
114
- */
115
- public tsCheck( toCheck : CANDIDATE | undefined | null ) : CANDIDATE {
117
+ * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }.*/
118
+ public static tsCheck<CANDIDATE>( toCheck : CANDIDATE | undefined | null ) : CANDIDATE {
116
119
  const result = DEFINED.checkAlgorithm(toCheck );
117
120
 
118
121
  if( result ) {
@@ -4,7 +4,7 @@ import { DBC } from "../DBC";
4
4
  *
5
5
  * @remarks
6
6
  * Maintainer: Salvatore Callari (XDBC@WaXCode.net) */
7
- export class INSTANCE < CANDIDATE = any > extends DBC {
7
+ export class INSTANCE extends DBC {
8
8
  /**
9
9
  * Checks if the value **toCheck** is complies to the {@link RegExp } **expression**.
10
10
  *
@@ -113,12 +113,15 @@ export class INSTANCE < CANDIDATE = any > extends DBC {
113
113
  return INSTANCE.checkAlgorithm(toCheck, this.reference);
114
114
  }
115
115
  /**
116
+ * Invokes the {@link INSTANCE.checkAlgorithm } passing the value **toCheck** and the {@link INSTANCE.reference } .
117
+ *
118
+ * @param See {@link INSTANCE.checkAlgorithm }.
119
+ *
120
+ * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link INSTANCE }.
116
121
  *
117
- * @param toCheck
118
- * @returns
119
- */
120
- public tsCheck( toCheck : any ) : CANDIDATE {
121
- const result = INSTANCE.checkAlgorithm(toCheck, this.reference);
122
+ * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }. */
123
+ public static tsCheck < CANDIDATE > ( toCheck : any, reference : any ) : CANDIDATE {
124
+ const result = INSTANCE.checkAlgorithm(toCheck, reference);
122
125
 
123
126
  if( result ) {
124
127
  return toCheck ;