xdbc 1.0.85 → 1.0.86
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/DBC/AE.js +3 -9
- package/dist/DBC/OR.js +101 -0
- package/dist/DBC/REGEX.js +0 -1
- package/dist/DBC.js +23 -0
- package/package.json +1 -1
- package/src/DBC/AE.ts +17 -16
- package/src/DBC/OR.ts +145 -0
- package/src/DBC/REGEX.ts +1 -2
- package/src/DBC.ts +25 -0
package/dist/DBC/AE.js
CHANGED
|
@@ -25,9 +25,7 @@ export class AE extends DBC {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns As soon as the "condition" returns a {@link string }, instead of TRUE, the returned string. TRUE if the
|
|
27
27
|
* "condition" never returns a {@link string}. */
|
|
28
|
-
static checkAlgorithm(
|
|
29
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
30
|
-
condition, value, index, idxEnd) {
|
|
28
|
+
static checkAlgorithm(condition, value, index, idxEnd) {
|
|
31
29
|
if (Array.isArray(value)) {
|
|
32
30
|
if (index !== undefined && idxEnd === undefined) {
|
|
33
31
|
if (index > -1 && index < value.length) {
|
|
@@ -85,9 +83,7 @@ export class AE extends DBC {
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
else {
|
|
88
|
-
return AE.checkAlgorithm(
|
|
89
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
90
|
-
realConditions, value, index, idxEnd);
|
|
86
|
+
return AE.checkAlgorithm(realConditions, value, index, idxEnd);
|
|
91
87
|
}
|
|
92
88
|
return true;
|
|
93
89
|
}, dbc, path);
|
|
@@ -133,9 +129,7 @@ export class AE extends DBC {
|
|
|
133
129
|
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
134
130
|
*
|
|
135
131
|
* @returns See {@link EQ.checkAlgorithm}. */
|
|
136
|
-
check(
|
|
137
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
138
|
-
toCheck) {
|
|
132
|
+
check(toCheck) {
|
|
139
133
|
if (Array.isArray(this.conditions)) {
|
|
140
134
|
for (const currentCondition of this.conditions) {
|
|
141
135
|
const result = AE.checkAlgorithm(currentCondition, toCheck, this.index, this.idxEnd);
|
package/dist/DBC/OR.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DBC } from "../DBC.js";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link DBC } defining that all elements of an {@link object }s have to fulfill
|
|
4
|
+
* one of the given {@link object }s check-methods (( toCheck : any ) => boolean | string ).
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
|
|
8
|
+
export class OR extends DBC {
|
|
9
|
+
// #region Condition checking.
|
|
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.
|
|
13
|
+
*
|
|
14
|
+
* @param conditions The { check: (toCheck: any) => boolean | string }-{@link object }s 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
|
+
* checked itself.
|
|
17
|
+
* @param index If specified with "idxEnd" being undefined, this {@link Number } will be seen as the index of
|
|
18
|
+
* the value-{@link Array }'s element to check. If value isn't an {@link Array } this parameter
|
|
19
|
+
* will not have any effect.
|
|
20
|
+
* With "idxEnd" not undefined this parameter indicates the beginning of the span of elements to
|
|
21
|
+
* check within the value-{@link Array }.
|
|
22
|
+
* @param idxEnd Indicates the last element's index (including) of the span of value-{@link Array } elements to check.
|
|
23
|
+
* Setting this parameter to -1 specifies that all value-{@link Array }'s elements beginning from the
|
|
24
|
+
* specified "index" shall be checked.
|
|
25
|
+
*
|
|
26
|
+
* @returns TRUE if at least one of the provided "conditions" is fulfilled, otherwise a {@link string } containing all "conditions" returned {@link string }s separated by " || ". */
|
|
27
|
+
static checkAlgorithm(conditions, value) {
|
|
28
|
+
let result = "";
|
|
29
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
30
|
+
const conditionResult = conditions[i].check(value);
|
|
31
|
+
if (typeof conditionResult !== "boolean") {
|
|
32
|
+
result += `${conditionResult}${i === conditions.length - 1 ? "" : " || "}`;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A parameter-decorator factory using the {@link OR.checkAlgorithm } with either multiple or a single one
|
|
42
|
+
* of the "realConditions" to check the tagged parameter-value against with.
|
|
43
|
+
* When specifying an "index" and the tagged parameter's "value" is an {@link Array }, the "realConditions" apply to the
|
|
44
|
+
* element at the specified "index".
|
|
45
|
+
* If the {@link Array } is too short the currently processed { check: (toCheck: any) => boolean | string } of
|
|
46
|
+
* "realConditions" will be verified to TRUE automatically, considering optional parameters.
|
|
47
|
+
* If an "index" is specified but the tagged parameter's value isn't an array, the "index" is treated as being undefined.
|
|
48
|
+
* If "index" is undefined and the tagged parameter's value is an {@link Array } each element of it will be checked
|
|
49
|
+
* against the "realConditions".
|
|
50
|
+
*
|
|
51
|
+
* @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
|
|
52
|
+
* against with.
|
|
53
|
+
* @param path See {@link DBC.decPrecondition }.
|
|
54
|
+
* @param dbc See {@link DBC.decPrecondition }.
|
|
55
|
+
*
|
|
56
|
+
* @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" returns one.
|
|
57
|
+
* Otherwise TRUE. */
|
|
58
|
+
static PRE(conditions, path = undefined, dbc = "WaXCode.DBC") {
|
|
59
|
+
return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
|
|
60
|
+
return OR.checkAlgorithm(conditions, value);
|
|
61
|
+
}, dbc, path);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A method-decorator factory using the {@link OR.checkAlgorithm } with either multiple or a single one
|
|
65
|
+
* of the "realConditions" to check the tagged method's return-value against with.
|
|
66
|
+
*
|
|
67
|
+
* @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
|
|
68
|
+
* against with.
|
|
69
|
+
* @param path See {@link DBC.decPrecondition }.
|
|
70
|
+
* @param dbc See {@link DBC.decPrecondition }.
|
|
71
|
+
*
|
|
72
|
+
* @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" return one.
|
|
73
|
+
* Otherwise TRUE. */
|
|
74
|
+
static POST(conditions, path = undefined, dbc = "WaXCode.DBC") {
|
|
75
|
+
return DBC.decPostcondition((value, target, propertyKey) => {
|
|
76
|
+
return OR.checkAlgorithm(conditions, value);
|
|
77
|
+
}, dbc, path);
|
|
78
|
+
}
|
|
79
|
+
// #endregion Condition checking.
|
|
80
|
+
// #region Referenced Condition checking.
|
|
81
|
+
//
|
|
82
|
+
// For usage in dynamic scenarios (like global functions).
|
|
83
|
+
//
|
|
84
|
+
/**
|
|
85
|
+
* Invokes the {@link OR.checkAlgorithm } passing the value "toCheck" and {@link OR.conditions }.
|
|
86
|
+
*
|
|
87
|
+
* @param toCheck See {@link OR.checkAlgorithm }.
|
|
88
|
+
*
|
|
89
|
+
* @returns See {@link OR.checkAlgorithm}. */
|
|
90
|
+
check(toCheck) {
|
|
91
|
+
return OR.checkAlgorithm(this.conditions, toCheck);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates this {@link OR } by setting the protected property {@link OR.conditions } used by {@link OR.check }.
|
|
95
|
+
*
|
|
96
|
+
* @param conditions See {@link OR.check }. */
|
|
97
|
+
constructor(conditions) {
|
|
98
|
+
super();
|
|
99
|
+
this.conditions = conditions;
|
|
100
|
+
}
|
|
101
|
+
}
|
package/dist/DBC/REGEX.js
CHANGED
|
@@ -63,7 +63,6 @@ export class REGEX extends DBC {
|
|
|
63
63
|
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
64
64
|
*
|
|
65
65
|
* @returns See {@link EQ.checkAlgorithm}. */
|
|
66
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
67
66
|
check(toCheck) {
|
|
68
67
|
return REGEX.checkAlgorithm(toCheck, this.expression);
|
|
69
68
|
}
|
package/dist/DBC.js
CHANGED
|
@@ -93,6 +93,29 @@ export class DBC {
|
|
|
93
93
|
return descriptor;
|
|
94
94
|
}
|
|
95
95
|
// #endregion Parameter-value requests.
|
|
96
|
+
// #region Invariant
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @param toCheck
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
check(toCheck) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @param conditions
|
|
108
|
+
* @param property
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
static decInvariant(conditions, property) {
|
|
112
|
+
return (toCheck) => {
|
|
113
|
+
for (const condition of conditions) {
|
|
114
|
+
condition.check(new toCheck(...[])[property]);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// #endregion Invariant
|
|
96
119
|
// #region Postcondition
|
|
97
120
|
/**
|
|
98
121
|
*
|
package/package.json
CHANGED
package/src/DBC/AE.ts
CHANGED
|
@@ -26,8 +26,9 @@ export class AE extends DBC {
|
|
|
26
26
|
* @returns As soon as the "condition" returns a {@link string }, instead of TRUE, the returned string. TRUE if the
|
|
27
27
|
* "condition" never returns a {@link string}. */
|
|
28
28
|
public static checkAlgorithm(
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
condition: {
|
|
30
|
+
check: (toCheck: unknown | null | undefined) => boolean | string;
|
|
31
|
+
},
|
|
31
32
|
value: object,
|
|
32
33
|
index: number | undefined,
|
|
33
34
|
idxEnd: number | undefined,
|
|
@@ -86,10 +87,11 @@ export class AE extends DBC {
|
|
|
86
87
|
* @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" returns one.
|
|
87
88
|
* Otherwise TRUE. */
|
|
88
89
|
public static PRE(
|
|
89
|
-
realConditions:
|
|
90
|
-
| Array<{
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
realConditions:
|
|
91
|
+
| Array<{
|
|
92
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
93
|
+
}>
|
|
94
|
+
| { check: (toCheck: unknown | undefined | null) => boolean | string },
|
|
93
95
|
index: number | undefined = undefined,
|
|
94
96
|
idxEnd: number | undefined = undefined,
|
|
95
97
|
path: string | undefined = undefined,
|
|
@@ -119,8 +121,9 @@ export class AE extends DBC {
|
|
|
119
121
|
}
|
|
120
122
|
} else {
|
|
121
123
|
return AE.checkAlgorithm(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
realConditions as {
|
|
125
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
126
|
+
},
|
|
124
127
|
value,
|
|
125
128
|
index,
|
|
126
129
|
idxEnd,
|
|
@@ -200,10 +203,7 @@ export class AE extends DBC {
|
|
|
200
203
|
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
201
204
|
*
|
|
202
205
|
* @returns See {@link EQ.checkAlgorithm}. */
|
|
203
|
-
public check(
|
|
204
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
205
|
-
toCheck: any,
|
|
206
|
-
) {
|
|
206
|
+
public check(toCheck: object) {
|
|
207
207
|
if (Array.isArray(this.conditions)) {
|
|
208
208
|
for (const currentCondition of this.conditions) {
|
|
209
209
|
const result = AE.checkAlgorithm(
|
|
@@ -232,10 +232,11 @@ export class AE extends DBC {
|
|
|
232
232
|
*
|
|
233
233
|
* @param equivalent See {@link EQ.check }. */
|
|
234
234
|
public constructor(
|
|
235
|
-
protected conditions:
|
|
236
|
-
| Array<{
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
protected conditions:
|
|
236
|
+
| Array<{
|
|
237
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
238
|
+
}>
|
|
239
|
+
| { check: (toCheck: unknown | undefined | null) => boolean | string },
|
|
239
240
|
protected index: number | undefined = undefined,
|
|
240
241
|
protected idxEnd: number | undefined = undefined,
|
|
241
242
|
) {
|
package/src/DBC/OR.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { DBC } from "../DBC.js";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link DBC } defining that all elements of an {@link object }s have to fulfill
|
|
4
|
+
* one of the given {@link object }s check-methods (( toCheck : any ) => boolean | string ).
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
|
|
8
|
+
export class OR extends DBC {
|
|
9
|
+
// #region Condition checking.
|
|
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.
|
|
13
|
+
*
|
|
14
|
+
* @param conditions The { check: (toCheck: any) => boolean | string }-{@link object }s 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
|
+
* checked itself.
|
|
17
|
+
* @param index If specified with "idxEnd" being undefined, this {@link Number } will be seen as the index of
|
|
18
|
+
* the value-{@link Array }'s element to check. If value isn't an {@link Array } this parameter
|
|
19
|
+
* will not have any effect.
|
|
20
|
+
* With "idxEnd" not undefined this parameter indicates the beginning of the span of elements to
|
|
21
|
+
* check within the value-{@link Array }.
|
|
22
|
+
* @param idxEnd Indicates the last element's index (including) of the span of value-{@link Array } elements to check.
|
|
23
|
+
* Setting this parameter to -1 specifies that all value-{@link Array }'s elements beginning from the
|
|
24
|
+
* specified "index" shall be checked.
|
|
25
|
+
*
|
|
26
|
+
* @returns TRUE if at least one of the provided "conditions" is fulfilled, otherwise a {@link string } containing all "conditions" returned {@link string }s separated by " || ". */
|
|
27
|
+
public static checkAlgorithm(
|
|
28
|
+
conditions: Array<{
|
|
29
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
30
|
+
}>,
|
|
31
|
+
value: object,
|
|
32
|
+
): boolean | string {
|
|
33
|
+
let result = "";
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
36
|
+
const conditionResult = conditions[i].check(value);
|
|
37
|
+
|
|
38
|
+
if (typeof conditionResult !== "boolean") {
|
|
39
|
+
result += `${conditionResult}${i === conditions.length - 1 ? "" : " || "}`;
|
|
40
|
+
} else {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A parameter-decorator factory using the {@link OR.checkAlgorithm } with either multiple or a single one
|
|
49
|
+
* of the "realConditions" to check the tagged parameter-value against with.
|
|
50
|
+
* When specifying an "index" and the tagged parameter's "value" is an {@link Array }, the "realConditions" apply to the
|
|
51
|
+
* element at the specified "index".
|
|
52
|
+
* If the {@link Array } is too short the currently processed { check: (toCheck: any) => boolean | string } of
|
|
53
|
+
* "realConditions" will be verified to TRUE automatically, considering optional parameters.
|
|
54
|
+
* If an "index" is specified but the tagged parameter's value isn't an array, the "index" is treated as being undefined.
|
|
55
|
+
* If "index" is undefined and the tagged parameter's value is an {@link Array } each element of it will be checked
|
|
56
|
+
* against the "realConditions".
|
|
57
|
+
*
|
|
58
|
+
* @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
|
|
59
|
+
* against with.
|
|
60
|
+
* @param path See {@link DBC.decPrecondition }.
|
|
61
|
+
* @param dbc See {@link DBC.decPrecondition }.
|
|
62
|
+
*
|
|
63
|
+
* @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" returns one.
|
|
64
|
+
* Otherwise TRUE. */
|
|
65
|
+
public static PRE(
|
|
66
|
+
conditions: Array<{
|
|
67
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
68
|
+
}>,
|
|
69
|
+
path: string | undefined = undefined,
|
|
70
|
+
dbc = "WaXCode.DBC",
|
|
71
|
+
): (
|
|
72
|
+
target: object,
|
|
73
|
+
methodName: string | symbol,
|
|
74
|
+
parameterIndex: number,
|
|
75
|
+
) => void {
|
|
76
|
+
return DBC.decPrecondition(
|
|
77
|
+
(
|
|
78
|
+
value: object,
|
|
79
|
+
target: object,
|
|
80
|
+
methodName: string,
|
|
81
|
+
parameterIndex: number,
|
|
82
|
+
) => {
|
|
83
|
+
return OR.checkAlgorithm(conditions, value);
|
|
84
|
+
},
|
|
85
|
+
dbc,
|
|
86
|
+
path,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A method-decorator factory using the {@link OR.checkAlgorithm } with either multiple or a single one
|
|
91
|
+
* of the "realConditions" to check the tagged method's return-value against with.
|
|
92
|
+
*
|
|
93
|
+
* @param realConditions Either one or more { check: (toCheck: any) => boolean | string } to check the tagged parameter-value
|
|
94
|
+
* against with.
|
|
95
|
+
* @param path See {@link DBC.decPrecondition }.
|
|
96
|
+
* @param dbc See {@link DBC.decPrecondition }.
|
|
97
|
+
*
|
|
98
|
+
* @returns A {@link string } as soon as one { check: (toCheck: any) => boolean | string } of "realConditions" return one.
|
|
99
|
+
* Otherwise TRUE. */
|
|
100
|
+
public static POST(
|
|
101
|
+
conditions: Array<{
|
|
102
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
103
|
+
}>,
|
|
104
|
+
path: string | undefined = undefined,
|
|
105
|
+
dbc = "WaXCode.DBC",
|
|
106
|
+
): (
|
|
107
|
+
target: object,
|
|
108
|
+
propertyKey: string,
|
|
109
|
+
descriptor: PropertyDescriptor,
|
|
110
|
+
) => PropertyDescriptor {
|
|
111
|
+
return DBC.decPostcondition(
|
|
112
|
+
(value: object, target: object, propertyKey: string) => {
|
|
113
|
+
return OR.checkAlgorithm(conditions, value);
|
|
114
|
+
},
|
|
115
|
+
dbc,
|
|
116
|
+
path,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
// #endregion Condition checking.
|
|
120
|
+
// #region Referenced Condition checking.
|
|
121
|
+
//
|
|
122
|
+
// For usage in dynamic scenarios (like global functions).
|
|
123
|
+
//
|
|
124
|
+
/**
|
|
125
|
+
* Invokes the {@link OR.checkAlgorithm } passing the value "toCheck" and {@link OR.conditions }.
|
|
126
|
+
*
|
|
127
|
+
* @param toCheck See {@link OR.checkAlgorithm }.
|
|
128
|
+
*
|
|
129
|
+
* @returns See {@link OR.checkAlgorithm}. */
|
|
130
|
+
public check(toCheck: object) {
|
|
131
|
+
return OR.checkAlgorithm(this.conditions, toCheck);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates this {@link OR } by setting the protected property {@link OR.conditions } used by {@link OR.check }.
|
|
135
|
+
*
|
|
136
|
+
* @param conditions See {@link OR.check }. */
|
|
137
|
+
public constructor(
|
|
138
|
+
protected conditions: Array<{
|
|
139
|
+
check: (toCheck: unknown | undefined | null) => boolean | string;
|
|
140
|
+
}>,
|
|
141
|
+
) {
|
|
142
|
+
super();
|
|
143
|
+
}
|
|
144
|
+
// #endregion Referenced Condition checking.
|
|
145
|
+
}
|
package/src/DBC/REGEX.ts
CHANGED
|
@@ -106,8 +106,7 @@ export class REGEX extends DBC {
|
|
|
106
106
|
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
107
107
|
*
|
|
108
108
|
* @returns See {@link EQ.checkAlgorithm}. */
|
|
109
|
-
|
|
110
|
-
public check(toCheck: any) {
|
|
109
|
+
public check(toCheck: unknown | null | undefined) {
|
|
111
110
|
return REGEX.checkAlgorithm(toCheck, this.expression);
|
|
112
111
|
}
|
|
113
112
|
/**
|
package/src/DBC.ts
CHANGED
|
@@ -122,6 +122,31 @@ export class DBC {
|
|
|
122
122
|
return descriptor;
|
|
123
123
|
}
|
|
124
124
|
// #endregion Parameter-value requests.
|
|
125
|
+
// #region Invariant
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* @param toCheck
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
check(toCheck: unknown | null | undefined): boolean | string {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @param conditions
|
|
137
|
+
* @param property
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
140
|
+
public static decInvariant(conditions: Array<DBC>, property: string) {
|
|
141
|
+
return (
|
|
142
|
+
toCheck: new (...args: Array<unknown | null | undefined>) => object,
|
|
143
|
+
) => {
|
|
144
|
+
for (const condition of conditions) {
|
|
145
|
+
condition.check(new toCheck(...[])[property]);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// #endregion Invariant
|
|
125
150
|
// #region Postcondition
|
|
126
151
|
/**
|
|
127
152
|
*
|