xdbc 1.0.93 → 1.0.95

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.
Files changed (97) hide show
  1. package/.parcel-cache/bf96c58b6061a62a-BundleGraph +0 -0
  2. package/.parcel-cache/d7c812d65aeeac59-AssetGraph +0 -0
  3. package/.parcel-cache/data.mdb +0 -0
  4. package/.parcel-cache/e81759c1f106a17f-RequestGraph +0 -0
  5. package/.parcel-cache/fe0db3c4eb428be2-AssetGraph +0 -0
  6. package/.parcel-cache/lock.mdb +0 -0
  7. package/.parcel-cache/snapshot-e81759c1f106a17f.txt +4609 -0
  8. package/CODE_OF_CONDUCT.md +128 -0
  9. package/CONTRIBUTING.md +40 -0
  10. package/FUNDING.yml +3 -0
  11. package/LICENSE +21 -0
  12. package/README.md +96 -0
  13. package/SECURITY.md +36 -0
  14. package/Test.html +1 -1
  15. package/__tests__/DBC/AE.test.ts +62 -0
  16. package/__tests__/DBC/EQ.test.ts +13 -0
  17. package/__tests__/DBC/GREATER.test.ts +29 -0
  18. package/__tests__/DBC/INSTANCE.test.ts +13 -0
  19. package/__tests__/DBC/JSON.OP.test.ts +47 -0
  20. package/__tests__/DBC/JSON.Parse.test.ts +17 -0
  21. package/__tests__/DBC/OR.test.ts +14 -0
  22. package/__tests__/DBC/REGEX.test.ts +13 -0
  23. package/__tests__/DBC/TYPE.test.ts +13 -0
  24. package/babel.rc +12 -0
  25. package/dist/DBC/AE.js +39 -23
  26. package/dist/DBC/COMPARISON/GREATER.js +22 -0
  27. package/dist/DBC/COMPARISON.js +99 -0
  28. package/dist/DBC/EQ.js +21 -7
  29. package/dist/DBC/GREATER.js +19 -6
  30. package/dist/DBC/INSTANCE.js +22 -9
  31. package/dist/DBC/JSON.OP.js +19 -7
  32. package/dist/DBC/JSON.Parse.js +19 -7
  33. package/dist/DBC/OR.js +35 -23
  34. package/dist/DBC/REGEX.js +21 -9
  35. package/dist/DBC/TYPE.js +19 -7
  36. package/dist/DBC.js +112 -39
  37. package/dist/Demo.js +267 -0
  38. package/dist/bundle.js +1329 -0
  39. package/docs/.nojekyll +1 -0
  40. package/docs/assets/hierarchy.js +1 -0
  41. package/docs/assets/highlight.css +22 -0
  42. package/docs/assets/icons.js +18 -0
  43. package/docs/assets/icons.svg +1 -0
  44. package/docs/assets/main.js +60 -0
  45. package/docs/assets/navigation.js +1 -0
  46. package/docs/assets/search.js +1 -0
  47. package/docs/assets/style.css +1640 -0
  48. package/docs/classes/DBC.DBC.html +98 -0
  49. package/docs/classes/DBC_AE.AE.html +160 -0
  50. package/docs/classes/DBC_EQ.EQ.html +131 -0
  51. package/docs/classes/DBC_GREATER.GREATER.html +139 -0
  52. package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -0
  53. package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -0
  54. package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -0
  55. package/docs/classes/DBC_OR.OR.html +137 -0
  56. package/docs/classes/DBC_REGEX.REGEX.html +136 -0
  57. package/docs/classes/DBC_TYPE.TYPE.html +130 -0
  58. package/docs/classes/Demo.Demo.html +14 -0
  59. package/docs/hierarchy.html +1 -0
  60. package/docs/index.html +1 -0
  61. package/docs/modules/DBC.html +1 -0
  62. package/docs/modules/DBC_AE.html +1 -0
  63. package/docs/modules/DBC_EQ.html +1 -0
  64. package/docs/modules/DBC_GREATER.html +1 -0
  65. package/docs/modules/DBC_INSTANCE.html +1 -0
  66. package/docs/modules/DBC_JSON.OP.html +1 -0
  67. package/docs/modules/DBC_JSON.Parse.html +1 -0
  68. package/docs/modules/DBC_OR.html +1 -0
  69. package/docs/modules/DBC_REGEX.html +1 -0
  70. package/docs/modules/DBC_TYPE.html +1 -0
  71. package/docs/modules/Demo.html +1 -0
  72. package/jest.config.ts +20 -0
  73. package/package.json +23 -5
  74. package/src/DBC/AE.ts +49 -24
  75. package/src/DBC/COMPARISON/GREATER.ts +38 -0
  76. package/src/DBC/COMPARISON/GREATER_OR_EQUAL.ts +38 -0
  77. package/src/DBC/COMPARISON/LESS.ts +38 -0
  78. package/src/DBC/COMPARISON/LESS_OR_EQUAL.ts +38 -0
  79. package/src/DBC/COMPARISON.ts +150 -0
  80. package/src/DBC/EQ.ts +26 -8
  81. package/src/DBC/GREATER.ts +30 -7
  82. package/src/DBC/INSTANCE.ts +26 -10
  83. package/src/DBC/JSON.OP.ts +29 -8
  84. package/src/DBC/JSON.Parse.ts +24 -8
  85. package/src/DBC/OR.ts +42 -24
  86. package/src/DBC/REGEX.ts +26 -10
  87. package/src/DBC/TYPE.ts +24 -8
  88. package/src/DBC.ts +138 -46
  89. package/src/Demo.ts +211 -0
  90. package/tsconfig.json +3 -1
  91. package/typedoc.json +16 -0
  92. package/webpack.config.js +26 -0
  93. package/dist/DBC.min.js +0 -2
  94. package/dist/test.js +0 -110
  95. package/src/test.ts +0 -61
  96. package/test.js +0 -14
  97. package/test.ts +0 -11
package/dist/DBC/AE.js CHANGED
@@ -1,30 +1,30 @@
1
- import { DBC } from "../DBC.js";
1
+ import { DBC } from "../DBC";
2
2
  /**
3
3
  * A {@link DBC } defining that all elements of an {@link object }s have to fulfill
4
- * a given {@link object }'s check-method (( toCheck : any ) => boolean | string ).
4
+ * a given {@link object }'s check-method (**( toCheck : any ) => boolean | string**).
5
5
  *
6
6
  * @remarks
7
7
  * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
8
8
  export class AE extends DBC {
9
9
  // #region Condition checking.
10
10
  /**
11
- * Checks each element of the "value"-{@link Array < any >} against the given "condition", if it is one. If it is not
12
- * the "value" itself will be checked.
11
+ * Checks each element of the **value**-{@link Array < any >} against the given **condition**, if it is one. If it is not
12
+ * the **value** itself will be checked.
13
13
  *
14
- * @param condition The { check: (toCheck: any) => boolean | string } to check the "value" against.
15
- * @param value Either "value"-{@link Array < any >}, which's elements will be checked, or the value to be
14
+ * @param condition The { check: (toCheck: any) => boolean | string } to check the **value** against.
15
+ * @param value Either **value**-{@link Array < any >}, which's elements will be checked, or the value to be
16
16
  * checked itself.
17
- * @param index If specified with "idxEnd" being undefined, this {@link Number } will be seen as the index of
17
+ * @param index If specified with **idxEnd** being undefined, this {@link Number } will be seen as the index of
18
18
  * the value-{@link Array }'s element to check. If value isn't an {@link Array } this parameter
19
19
  * will not have any effect.
20
- * With "idxEnd" not undefined this parameter indicates the beginning of the span of elements to
20
+ * With **idxEnd** not undefined this parameter indicates the beginning of the span of elements to
21
21
  * check within the value-{@link Array }.
22
22
  * @param idxEnd Indicates the last element's index (including) of the span of value-{@link Array } elements to check.
23
23
  * Setting this parameter to -1 specifies that all value-{@link Array }'s elements beginning from the
24
- * specified "index" shall be checked.
24
+ * specified **index** shall be checked.
25
25
  *
26
- * @returns As soon as the "condition" returns a {@link string }, instead of TRUE, the returned string. TRUE if the
27
- * "condition" never returns a {@link string}. */
26
+ * @returns As soon as the **condition** returns a {@link string }, instead of TRUE, the returned string. TRUE if the
27
+ * **condition** never returns a {@link string}. */
28
28
  static checkAlgorithm(condition, value, index, idxEnd) {
29
29
  if (Array.isArray(value)) {
30
30
  if (index !== undefined && idxEnd === undefined) {
@@ -55,14 +55,14 @@ export class AE extends DBC {
55
55
  }
56
56
  /**
57
57
  * A parameter-decorator factory using the {@link AE.checkAlgorithm } with either multiple or a single one
58
- * of the "realConditions" to check the tagged parameter-value against with.
59
- * When specifying an "index" and the tagged parameter's "value" is an {@link Array }, the "realConditions" apply to the
60
- * element at the specified "index".
58
+ * of the **realConditions** to check the tagged parameter-value against with.
59
+ * When specifying an **index** and the tagged parameter's **value** is an {@link Array }, the **realConditions** apply to the
60
+ * element at the specified **index**.
61
61
  * If the {@link Array } is too short the currently processed { check: (toCheck: any) => boolean | string } of
62
- * "realConditions" will be verified to TRUE automatically, considering optional parameters.
63
- * If an "index" is specified but the tagged parameter's value isn't an array, the "index" is treated as being undefined.
64
- * If "index" is undefined and the tagged parameter's value is an {@link Array } each element of it will be checked
65
- * against the "realConditions".
62
+ * **realConditions** will be verified to TRUE automatically, considering optional parameters.
63
+ * If an **index** is specified but the tagged parameter's value isn't an array, the **index** is treated as being undefined.
64
+ * If **index** is undefined and the tagged parameter's value is an {@link Array } each element of it will be checked
65
+ * against the **realConditions**.
66
66
  *
67
67
  * @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
68
68
  * against with.
@@ -71,7 +71,7 @@ export class AE extends DBC {
71
71
  * @param path See {@link DBC.decPrecondition }.
72
72
  * @param dbc See {@link DBC.decPrecondition }.
73
73
  *
74
- * @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" returns one.
74
+ * @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of **realConditions** returns one.
75
75
  * Otherwise TRUE. */
76
76
  static PRE(realConditions, index = undefined, idxEnd = undefined, path = undefined, dbc = "WaXCode.DBC") {
77
77
  return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
@@ -90,7 +90,7 @@ export class AE extends DBC {
90
90
  }
91
91
  /**
92
92
  * A method-decorator factory using the {@link AE.checkAlgorithm } with either multiple or a single one
93
- * of the "realConditions" to check the tagged method's return-value against with.
93
+ * of the **realConditions** to check the tagged method's return-value against with.
94
94
  *
95
95
  * @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
96
96
  * against with.
@@ -99,7 +99,7 @@ export class AE extends DBC {
99
99
  * @param path See {@link DBC.decPrecondition }.
100
100
  * @param dbc See {@link DBC.decPrecondition }.
101
101
  *
102
- * @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" return one.
102
+ * @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of **realConditions** return one.
103
103
  * Otherwise TRUE. */
104
104
  static POST(realConditions, index = undefined, idxEnd = undefined, path = undefined, dbc = "WaXCode.DBC") {
105
105
  return DBC.decPostcondition((value, target, propertyKey) => {
@@ -118,15 +118,31 @@ export class AE extends DBC {
118
118
  return true;
119
119
  }, dbc, path);
120
120
  }
121
+ /**
122
+ * A field-decorator factory using the {@link AE.checkAlgorithm } with either multiple or a single one
123
+ * of the **realConditions** to check the tagged field.
124
+ *
125
+ * @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
126
+ * against with.
127
+ * @param index See the {@link AE.checkAlgorithm }.
128
+ * @param idxEnd See the {@link AE.checkAlgorithm }.
129
+ * @param path See {@link DBC.decInvariant }.
130
+ * @param dbc See {@link DBC.decInvariant }.
131
+ *
132
+ * @returns See {@link DBC.decInvariant }. */
133
+ static INVARIANT(realConditions, index = undefined, idxEnd = undefined, path = undefined, dbc = "WaXCode.DBC") {
134
+ return DBC.decInvariant([new AE(realConditions, index, idxEnd)], path, dbc);
135
+ }
121
136
  // #endregion Condition checking.
122
137
  // #region Referenced Condition checking.
123
138
  //
124
139
  // For usage in dynamic scenarios (like global functions).
125
140
  //
126
141
  /**
127
- * Invokes the {@link AE.checkAlgorithm } passing the value "toCheck", {@link AE.equivalent } and {@link EQ.invert }.
142
+ * Invokes the {@link AE.checkAlgorithm } with all {@link AE.conditions } and the {@link object } {@link toCheck },
143
+ * {@link AE.index } & {@link AE.idxEnd }.
128
144
  *
129
- * @param toCheck See {@link EQ.checkAlgorithm }.
145
+ * @param toCheck See {@link AE.checkAlgorithm }.
130
146
  *
131
147
  * @returns See {@link EQ.checkAlgorithm}. */
132
148
  check(toCheck) {
@@ -0,0 +1,22 @@
1
+ import { COMPARISON } from "../COMPARISON";
2
+ export class GREATER extends COMPARISON {
3
+ /** See {@link GREATER.PRE }. */
4
+ static PRE(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
5
+ return COMPARISON.PRE(equivalent, false, false, path, dbc);
6
+ }
7
+ /** See {@link GREATER.POST }. */
8
+ static POST(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
9
+ return COMPARISON.POST(equivalent, false, false, path, dbc);
10
+ }
11
+ /** See {@link GREATER.INVARIANT }. */
12
+ static INVARIANT(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
13
+ return COMPARISON.INVARIANT(equivalent, false, false, path, dbc);
14
+ }
15
+ /** See {@link GREATER.constructor }. */
16
+ constructor(equivalent, equalityPermitted = false, invert = false) {
17
+ super(equivalent, false, false);
18
+ this.equivalent = equivalent;
19
+ this.equalityPermitted = equalityPermitted;
20
+ this.invert = invert;
21
+ }
22
+ }
@@ -0,0 +1,99 @@
1
+ import { DBC } from "../DBC";
2
+ /**
3
+ * A {@link DBC } defining that two {@link object }s gotta be equal.
4
+ *
5
+ * @remarks
6
+ * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
7
+ export class COMPARISON extends DBC {
8
+ // #region Condition checking.
9
+ /**
10
+ * Checks if the value **toCheck** is nb equal to the specified **equivalent**.
11
+ *
12
+ * @param toCheck The value that has to be equal to it's possible **equivalent** for this {@link DBC } to be fulfilled.
13
+ * @param equivalent The {@link object } the one **toCheck** has to be equal to in order for this {@link DBC } to be
14
+ * fulfilled.
15
+ *
16
+ * @returns TRUE if the value **toCheck** and the **equivalent** are equal to each other, otherwise FALSE. */
17
+ static checkAlgorithm(toCheck, equivalent, equalityPermitted, invert) {
18
+ if (equalityPermitted && !invert && toCheck < equivalent) {
19
+ return `Value has to to be greater than or equal to "${equivalent}"`;
20
+ }
21
+ if (equalityPermitted && invert && toCheck > equivalent) {
22
+ return `Value must not to be less than or equal to "${equivalent}"`;
23
+ }
24
+ if (!equalityPermitted && !invert && toCheck <= equivalent) {
25
+ return `Value has to to be greater than "${equivalent}"`;
26
+ }
27
+ if (!equalityPermitted && invert && toCheck >= equivalent) {
28
+ return `Value must not to be less than "${equivalent}"`;
29
+ }
30
+ return true;
31
+ }
32
+ /**
33
+ * A parameter-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
34
+ * by the tagged parameter.
35
+ *
36
+ * @param equivalent See {@link GREATER.checkAlgorithm }.
37
+ * @param equalityPermitted See {@link GREATER.checkAlgorithm }.
38
+ * @param path See {@link DBC.decPrecondition }.
39
+ * @param dbc See {@link DBC.decPrecondition }.
40
+ *
41
+ * @returns See {@link DBC.decPrecondition }. */
42
+ static PRE(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
43
+ return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
44
+ return COMPARISON.checkAlgorithm(value, equivalent, equalityPermitted, invert);
45
+ }, dbc, path);
46
+ }
47
+ /**
48
+ * A method-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
49
+ * by the tagged method's returnvalue.
50
+ *
51
+ * @param equivalent See {@link GREATER.checkAlgorithm }.
52
+ * @param equalityPermitted See {@link GREATER.checkAlgorithm }.
53
+ * @param path See {@link DBC.Postcondition }.
54
+ * @param dbc See {@link DBC.decPostcondition }.
55
+ *
56
+ * @returns See {@link DBC.decPostcondition }. */
57
+ static POST(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
58
+ return DBC.decPostcondition((value, target, propertyKey) => {
59
+ return COMPARISON.checkAlgorithm(value, equalityPermitted, equivalent, invert);
60
+ }, dbc, path);
61
+ }
62
+ /**
63
+ * A field-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
64
+ * by the tagged field.
65
+ *
66
+ * @param equivalent See {@link GREATER.checkAlgorithm }.
67
+ * @param equalityPermitted See {@link GREATER.checkAlgorithm }.
68
+ * @param path See {@link DBC.decInvariant }.
69
+ * @param dbc See {@link DBC.decInvariant }.
70
+ *
71
+ * @returns See {@link DBC.decInvariant }. */
72
+ static INVARIANT(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
73
+ return DBC.decInvariant([new COMPARISON(equivalent, equalityPermitted, invert)], path, dbc);
74
+ }
75
+ // #endregion Condition checking.
76
+ // #region Referenced Condition checking.
77
+ // #region Dynamic usage.
78
+ /**
79
+ * Invokes the {@link GREATER.checkAlgorithm } passing the value **toCheck**, {@link GREATER.equivalent } and {@link GREATER.invert }.
80
+ *
81
+ * @param toCheck See {@link GREATER.checkAlgorithm }.
82
+ *
83
+ * @returns See {@link GREATER.checkAlgorithm}. */
84
+ check(toCheck) {
85
+ return COMPARISON.checkAlgorithm(toCheck, this.equivalent, this.equalityPermitted, this.invert);
86
+ }
87
+ /**
88
+ * Creates this {@link GREATER } by setting the protected property {@link GREATER.equivalent }, {@link GREATER.equalityPermitted } and {@link GREATER.invert } used by {@link GREATER.check }.
89
+ *
90
+ * @param equivalent See {@link GREATER.check }.
91
+ * @param equalityPermitted See {@link GREATER.check }.
92
+ * @param invert See {@link GREATER.check }. */
93
+ constructor(equivalent, equalityPermitted = false, invert = false) {
94
+ super();
95
+ this.equivalent = equivalent;
96
+ this.equalityPermitted = equalityPermitted;
97
+ this.invert = invert;
98
+ }
99
+ }
package/dist/DBC/EQ.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DBC } from "../DBC.js";
1
+ import { DBC } from "../DBC";
2
2
  /**
3
3
  * A {@link DBC } defining that two {@link object }s gotta be equal.
4
4
  *
@@ -7,13 +7,13 @@ import { DBC } from "../DBC.js";
7
7
  export class EQ extends DBC {
8
8
  // #region Condition checking.
9
9
  /**
10
- * Checks if the value "toCheck" is equal to the specified "equivalent".
10
+ * Checks if the value **toCheck** is equal to the specified **equivalent**.
11
11
  *
12
- * @param toCheck The value that has to be equal to it's possible "equivalent" for this {@link DBC } to be fulfilled.
13
- * @param equivalent The {@link object } the one "toCheck" has to be equal to in order for this {@link DBC } to be
12
+ * @param toCheck The value that has to be equal to it's possible **equivalent** for this {@link DBC } to be fulfilled.
13
+ * @param equivalent The {@link object } the one **toCheck** has to be equal to in order for this {@link DBC } to be
14
14
  * fulfilled.
15
15
  *
16
- * @returns TRUE if the value "toCheck" and the "equivalent" are equal to each other, otherwise FALSE. */
16
+ * @returns TRUE if the value **toCheck** and the **equivalent** are equal to each other, otherwise FALSE. */
17
17
  static checkAlgorithm(
18
18
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
19
19
  toCheck, equivalent, invert) {
@@ -57,18 +57,32 @@ export class EQ extends DBC {
57
57
  return EQ.checkAlgorithm(value, equivalent, invert);
58
58
  }, dbc, path);
59
59
  }
60
+ /**
61
+ * A field-decorator factory using the {@link EQ.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
62
+ * by the tagged field.
63
+ *
64
+ * @param equivalent See {@link EQ.checkAlgorithm }.
65
+ * @param path See {@link DBC.decInvariant }.
66
+ * @param dbc See {@link DBC.decInvariant }.
67
+ *
68
+ * @returns See {@link DBC.decInvariant }. */
69
+ static INVARIANT(
70
+ // biome-ignore lint/suspicious/noExplicitAny: To check for UNDEFINED and NULL.
71
+ equivalent, invert = false, path = undefined, dbc = "WaXCode.DBC") {
72
+ return DBC.decInvariant([new EQ(equivalent, invert)], path, dbc);
73
+ }
60
74
  // #endregion Condition checking.
61
75
  // #region Referenced Condition checking.
62
76
  //
63
77
  // For usage in dynamic scenarios (like with AE-DBC).
64
78
  //
65
79
  /**
66
- * Invokes the {@link EQ.checkAlgorithm } passing the value "toCheck", {@link EQ.equivalent } and {@link EQ.invert }.
80
+ * Invokes the {@link EQ.checkAlgorithm } passing the value **toCheck**, {@link EQ.equivalent } and {@link EQ.invert }.
67
81
  *
68
82
  * @param toCheck See {@link EQ.checkAlgorithm }.
69
83
  *
70
84
  * @returns See {@link EQ.checkAlgorithm}. */
71
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
85
+ // biome-ignore lint/suspicious/noExplicitAny: Necessary to check against NULL & UNDEFINED.
72
86
  check(toCheck) {
73
87
  return EQ.checkAlgorithm(toCheck, this.equivalent, this.invert);
74
88
  }
@@ -1,4 +1,4 @@
1
- import { DBC } from "../DBC.js";
1
+ import { DBC } from "../DBC";
2
2
  /**
3
3
  * A {@link DBC } defining that two {@link object }s gotta be equal.
4
4
  *
@@ -7,13 +7,13 @@ import { DBC } from "../DBC.js";
7
7
  export class GREATER extends DBC {
8
8
  // #region Condition checking.
9
9
  /**
10
- * Checks if the value "toCheck" is nb equal to the specified "equivalent".
10
+ * Checks if the value **toCheck** is equal to the specified **equivalent**.
11
11
  *
12
- * @param toCheck The value that has to be equal to it's possible "equivalent" for this {@link DBC } to be fulfilled.
13
- * @param equivalent The {@link object } the one "toCheck" has to be equal to in order for this {@link DBC } to be
12
+ * @param toCheck The value that has to be equal to it's possible **equivalent** for this {@link DBC } to be fulfilled.
13
+ * @param equivalent The {@link object } the one **toCheck** has to be equal to in order for this {@link DBC } to be
14
14
  * fulfilled.
15
15
  *
16
- * @returns TRUE if the value "toCheck" and the "equivalent" are equal to each other, otherwise FALSE. */
16
+ * @returns TRUE if the value **toCheck** and the **equivalent** are equal to each other, otherwise FALSE. */
17
17
  static checkAlgorithm(toCheck, equivalent, equalityPermitted, invert) {
18
18
  if (equalityPermitted && !invert && toCheck < equivalent) {
19
19
  return `Value has to to be greater than or equal to "${equivalent}"`;
@@ -59,11 +59,24 @@ export class GREATER extends DBC {
59
59
  return GREATER.checkAlgorithm(value, equalityPermitted, equivalent, invert);
60
60
  }, dbc, path);
61
61
  }
62
+ /**
63
+ * A field-decorator factory using the {@link GREATER.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
64
+ * by the tagged field.
65
+ *
66
+ * @param equivalent See {@link GREATER.checkAlgorithm }.
67
+ * @param equalityPermitted See {@link GREATER.checkAlgorithm }.
68
+ * @param path See {@link DBC.decInvariant }.
69
+ * @param dbc See {@link DBC.decInvariant }.
70
+ *
71
+ * @returns See {@link DBC.decInvariant }. */
72
+ static INVARIANT(equivalent, equalityPermitted = false, invert = false, path = undefined, dbc = "WaXCode.DBC") {
73
+ return DBC.decInvariant([new GREATER(equivalent, equalityPermitted, invert)], path, dbc);
74
+ }
62
75
  // #endregion Condition checking.
63
76
  // #region Referenced Condition checking.
64
77
  // #region Dynamic usage.
65
78
  /**
66
- * Invokes the {@link GREATER.checkAlgorithm } passing the value "toCheck", {@link GREATER.equivalent } and {@link GREATER.invert }.
79
+ * Invokes the {@link GREATER.checkAlgorithm } passing the value **toCheck**, {@link GREATER.equivalent } and {@link GREATER.invert }.
67
80
  *
68
81
  * @param toCheck See {@link GREATER.checkAlgorithm }.
69
82
  *
@@ -1,19 +1,18 @@
1
- import { DBC } from "../DBC.js";
1
+ import { DBC } from "../DBC";
2
2
  /**
3
3
  * A {@link DBC } defining that the an {@link object }s gotta be an instance of a certain {@link INSTANCE.reference }.
4
4
  *
5
5
  * @remarks
6
- * Author: Salvatore Callari (Callari@WaXCode.net) / 2025
7
- * Maintainer: Salvatore Callari (XDBC@WaXCode.net) */
6
+ * Maintainer: Salvatore Callari (XDBC@WaXCode.net) */
8
7
  export class INSTANCE extends DBC {
9
8
  /**
10
- * Checks if the value "toCheck" is complies to the {@link RegExp } "expression".
9
+ * Checks if the value **toCheck** is complies to the {@link RegExp } **expression**.
11
10
  *
12
- * @param toCheck The value that has comply to the {@link RegExp } "expression" for this {@link DBC } to be fulfilled.
13
- * @param reference The {@link RegExp } the one "toCheck" has comply to in order for this {@link DBC } to be
14
- * fulfilled.
11
+ * @param toCheck The value that has comply to the {@link RegExp } **expression** for this {@link DBC } to be fulfilled.
12
+ * @param reference The {@link RegExp } the one **toCheck** has comply to in order for this {@link DBC } to be
13
+ * fulfilled.
15
14
  *
16
- * @returns TRUE if the value "toCheck" is of the specified "type", otherwise FALSE. */
15
+ * @returns TRUE if the value **toCheck** is of the specified **type**, otherwise FALSE. */
17
16
  // biome-ignore lint/suspicious/noExplicitAny: In order to perform an "instanceof" check.
18
17
  static checkAlgorithm(toCheck, reference) {
19
18
  if (!(toCheck instanceof reference)) {
@@ -53,13 +52,27 @@ export class INSTANCE extends DBC {
53
52
  return INSTANCE.checkAlgorithm(value, reference);
54
53
  }, dbc, path);
55
54
  }
55
+ /**
56
+ * A field-decorator factory using the {@link INSTANCE.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
57
+ * by the tagged method's returnvalue.
58
+ *
59
+ * @param reference See {@link INSTANCE.checkAlgorithm }.
60
+ * @param path See {@link DBC.decInvariant }.
61
+ * @param dbc See {@link DBC.decInvariant }.
62
+ *
63
+ * @returns See {@link DBC.decInvariant }. */
64
+ static INVARIANT(
65
+ // biome-ignore lint/suspicious/noExplicitAny: In order to perform an "instanceof" check.
66
+ reference, path = undefined, dbc = "WaXCode.DBC") {
67
+ return DBC.decInvariant([new INSTANCE(reference)], path, dbc);
68
+ }
56
69
  // #endregion Condition checking.
57
70
  // #region Referenced Condition checking.
58
71
  //
59
72
  // For usage in dynamic scenarios (like with AE-DBC).
60
73
  //
61
74
  /**
62
- * Invokes the {@link INSTANCE.checkAlgorithm } passing the value "toCheck" and the {@link INSTANCE.reference } .
75
+ * Invokes the {@link INSTANCE.checkAlgorithm } passing the value **toCheck** and the {@link INSTANCE.reference } .
63
76
  *
64
77
  * @param toCheck See {@link INSTANCE.checkAlgorithm }.
65
78
  *
@@ -7,16 +7,16 @@ import { DBC } from "../DBC";
7
7
  export class JSON_OP extends DBC {
8
8
  // #region Condition checking.
9
9
  /**
10
- * Checks if the object "toCheck" has the "necessaryProperties" of necessary type.
10
+ * Checks if the object **toCheck** has the **necessaryProperties** of necessary type.
11
11
  *
12
12
  * @param toCheck The {@link object } to check for the necessary properties.
13
- * @param necessaryProperties The { name : string, type : string }s defining the properties and type the {@link object } to
13
+ * @param necessaryProperties The **{ name : string, type : string }**s defining the properties and type the {@link object } to
14
14
  * check needs to have.
15
- * @param checkElements Indicates if "toCheck" is an iterable object of which all elements have to be checked.
16
- * Elements will only be checked if "toCheck" is iterable, otherwise "toCheck" itself
15
+ * @param checkElements Indicates if **toCheck** is an iterable object of which all elements have to be checked.
16
+ * Elements will only be checked if **toCheck** is iterable, otherwise **toCheck** itself
17
17
  * will be checked.
18
18
  *
19
- * @returns TRUE if the value "toCheck" or it's elements, if "checkElements is TRUE, has all "necessaryProperties", otherwise a {@link string } to report the infringement. */
19
+ * @returns TRUE if the value **toCheck** or it's elements, if **checkElements** is TRUE, has all **necessaryProperties**, otherwise a {@link string } to report the infringement. */
20
20
  static checkAlgorithm(
21
21
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
22
22
  toCheck, necessaryProperties, checkElements) {
@@ -76,13 +76,25 @@ export class JSON_OP extends DBC {
76
76
  return JSON_OP.checkAlgorithm(value, necessaryProperties, checkElements);
77
77
  }, dbc, path);
78
78
  }
79
+ /**
80
+ * A field-decorator factory using the {@link JSON_OP.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
81
+ * by the tagged field.
82
+ *
83
+ * @param expression See {@link JSON.checkAlgorithm }.
84
+ * @param path See {@link DBC.decInvariant }.
85
+ * @param dbc See {@link DBC.decInvariant }.
86
+ *
87
+ * @returns See {@link DBC.decPostcondition }. */
88
+ static INVARIANT(necessaryProperties, checkElements = false, path = undefined, dbc = "WaXCode.DBC") {
89
+ return DBC.decInvariant([new JSON_OP(necessaryProperties, checkElements)], path, dbc);
90
+ }
79
91
  // #endregion Condition checking.
80
92
  // #region Referenced Condition checking.
81
93
  //
82
94
  // For usage in dynamic scenarios (like with AE-DBC).
83
95
  //
84
96
  /**
85
- * Invokes the {@link JSON_OP.checkAlgorithm } passing the value "toCheck", {@link JSON_OP.necessaryProperties } and {@link JSON_OP.checkElements }.
97
+ * Invokes the {@link JSON_OP.checkAlgorithm } passing the value **toCheck**, {@link JSON_OP.necessaryProperties } and {@link JSON_OP.checkElements }.
86
98
  *
87
99
  * @param toCheck See {@link JSON_OP.checkAlgorithm }.
88
100
  *
@@ -104,7 +116,7 @@ export class JSON_OP extends DBC {
104
116
  // #endregion Referenced Condition checking.
105
117
  // #region In-Method checking.
106
118
  /**
107
- * Invokes the {@link JSON_OP.checkAlgorithm } passing the value "toCheck", {@link JSON_OP.necessaryProperties } and {@link JSON_OP.checkElements }.
119
+ * Invokes the {@link JSON_OP.checkAlgorithm } passing the value **toCheck**, {@link JSON_OP.necessaryProperties } and {@link JSON_OP.checkElements }.
108
120
  *
109
121
  * @param toCheck See {@link JSON_OP.checkAlgorithm} }.
110
122
  * @param necessaryProperties See {@link JSON_OP.checkAlgorithm} }.
@@ -7,13 +7,13 @@ import { DBC } from "../DBC";
7
7
  export class JSON_Parse extends DBC {
8
8
  // #region Condition checking.
9
9
  /**
10
- * Tries to {@link JSON.parse } the {@link string } "toCheck" invoking the "receptor" with the result, if so.
10
+ * Tries to {@link JSON.parse } the {@link string } **toCheck** invoking the **receptor** with the result, if so.
11
11
  *
12
12
  * @param toCheck The {@link string } to be {@link JSON.parse }d.
13
- * @param receptor The ( json : object ) => void to receive the {@link JSON.parse }d {@link string } "toCheck".
14
- * check needs to have.
13
+ * @param receptor The **( json : object ) => void** to receive the {@link JSON.parse }d {@link string } **toCheck**.
14
+ * check needs to have.
15
15
  *
16
- * @returns TRUE if the value "toCheck" is a valid JSON, otherwise a {@link string } to report the infringement. */
16
+ * @returns TRUE if the value **toCheck** is a valid JSON, otherwise a {@link string } to report the infringement. */
17
17
  static checkAlgorithm(toCheck, receptor) {
18
18
  // biome-ignore lint/suspicious/noExplicitAny: JSON.parse returns any.
19
19
  let parsed;
@@ -58,13 +58,25 @@ export class JSON_Parse extends DBC {
58
58
  return JSON_Parse.checkAlgorithm(value, receptor);
59
59
  }, dbc, path);
60
60
  }
61
+ /**
62
+ * A field-decorator factory using the {@link JSON_Parse.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
63
+ * by the tagged field.
64
+ *
65
+ * @param expression See {@link JSON.checkAlgorithm }.
66
+ * @param path See {@link DBC.decInvariant }.
67
+ * @param dbc See {@link DBC.decInvariant }.
68
+ *
69
+ * @returns See {@link DBC.decInvariant }. */
70
+ static INVARIANT(receptor, path = undefined, dbc = "WaXCode.DBC") {
71
+ return DBC.decInvariant([new JSON_Parse(receptor)], path, dbc);
72
+ }
61
73
  // #endregion Condition checking.
62
74
  // #region Referenced Condition checking.
63
75
  //
64
76
  // For usage in dynamic scenarios (like with AE-DBC).
65
77
  //
66
78
  /**
67
- * Invokes the {@link JSON_Parse.checkAlgorithm } passing the value "toCheck" and {@link JSON_Parse.receptor }.
79
+ * Invokes the {@link JSON_Parse.checkAlgorithm } passing the value **toCheck** and {@link JSON_Parse.receptor }.
68
80
  *
69
81
  * @param toCheck See {@link JSON_Parse.checkAlgorithm }.
70
82
  *
@@ -78,14 +90,14 @@ export class JSON_Parse extends DBC {
78
90
  *
79
91
  * @param necessaryProperties See {@link JSON_Parse.check }.
80
92
  * @param checkElements See {@link JSON_Parse.check }. */
81
- constructor(receptor) {
93
+ constructor(receptor = undefined) {
82
94
  super();
83
95
  this.receptor = receptor;
84
96
  }
85
97
  // #endregion Referenced Condition checking.
86
98
  // #region In-Method checking.
87
99
  /**
88
- * Invokes the {@link JSON_Parse.checkAlgorithm } passing the value "toCheck", {@link JSON_Parse.necessaryProperties } and {@link JSON_Parse.checkElements }.
100
+ * Invokes the {@link JSON_Parse.checkAlgorithm } passing the value **toCheck**, {@link JSON_Parse.necessaryProperties } and {@link JSON_Parse.checkElements }.
89
101
  *
90
102
  * @param toCheck See {@link JSON_Parse.checkAlgorithm} }.
91
103
  * @param necessaryProperties See {@link JSON_Parse.checkAlgorithm} }.