xdbc 1.0.86 → 1.0.87
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/REGEX.js +3 -9
- package/package.json +1 -1
- package/src/DBC/REGEX.ts +3 -9
package/dist/DBC/REGEX.js
CHANGED
|
@@ -14,9 +14,7 @@ export class REGEX extends DBC {
|
|
|
14
14
|
* fulfilled.
|
|
15
15
|
*
|
|
16
16
|
* @returns TRUE if the value "toCheck" complies with the {@link RegExp } "expression", otherwise FALSE. */
|
|
17
|
-
static checkAlgorithm(
|
|
18
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
19
|
-
toCheck, expression) {
|
|
17
|
+
static checkAlgorithm(toCheck, expression) {
|
|
20
18
|
if (!expression.test(toCheck)) {
|
|
21
19
|
return `Value has to comply to regular expression "${expression}"`;
|
|
22
20
|
}
|
|
@@ -46,9 +44,7 @@ export class REGEX extends DBC {
|
|
|
46
44
|
*
|
|
47
45
|
* @returns See {@link DBC.decPostcondition }. */
|
|
48
46
|
static POST(expression, path = undefined, dbc = "WaXCode.DBC") {
|
|
49
|
-
return DBC.decPostcondition(
|
|
50
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
51
|
-
(value, target, propertyKey) => {
|
|
47
|
+
return DBC.decPostcondition((value, target, propertyKey) => {
|
|
52
48
|
return REGEX.checkAlgorithm(value, expression);
|
|
53
49
|
}, dbc, path);
|
|
54
50
|
}
|
|
@@ -82,9 +78,7 @@ export class REGEX extends DBC {
|
|
|
82
78
|
* @param toCheck See {@link JSON_OP.checkAlgorithm} }.
|
|
83
79
|
* @param expression See {@link JSON_OP.checkAlgorithm} }.
|
|
84
80
|
*/
|
|
85
|
-
static check(
|
|
86
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
87
|
-
toCheck, expression) {
|
|
81
|
+
static check(toCheck, expression) {
|
|
88
82
|
const checkResult = REGEX.checkAlgorithm(toCheck, expression);
|
|
89
83
|
if (typeof checkResult === "string") {
|
|
90
84
|
throw new DBC.Infringement(checkResult);
|
package/package.json
CHANGED
package/src/DBC/REGEX.ts
CHANGED
|
@@ -27,8 +27,7 @@ export class REGEX extends DBC {
|
|
|
27
27
|
*
|
|
28
28
|
* @returns TRUE if the value "toCheck" complies with the {@link RegExp } "expression", otherwise FALSE. */
|
|
29
29
|
public static checkAlgorithm(
|
|
30
|
-
|
|
31
|
-
toCheck: any,
|
|
30
|
+
toCheck: unknown | null | undefined,
|
|
32
31
|
expression: RegExp,
|
|
33
32
|
): boolean | string {
|
|
34
33
|
if (!expression.test(toCheck as string)) {
|
|
@@ -87,8 +86,7 @@ export class REGEX extends DBC {
|
|
|
87
86
|
descriptor: PropertyDescriptor,
|
|
88
87
|
) => PropertyDescriptor {
|
|
89
88
|
return DBC.decPostcondition(
|
|
90
|
-
|
|
91
|
-
(value: any, target: object, propertyKey: string) => {
|
|
89
|
+
(value: string, target: object, propertyKey: string) => {
|
|
92
90
|
return REGEX.checkAlgorithm(value, expression);
|
|
93
91
|
},
|
|
94
92
|
dbc,
|
|
@@ -124,11 +122,7 @@ export class REGEX extends DBC {
|
|
|
124
122
|
* @param toCheck See {@link JSON_OP.checkAlgorithm} }.
|
|
125
123
|
* @param expression See {@link JSON_OP.checkAlgorithm} }.
|
|
126
124
|
*/
|
|
127
|
-
public static check(
|
|
128
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
129
|
-
toCheck: any,
|
|
130
|
-
expression: RegExp,
|
|
131
|
-
) {
|
|
125
|
+
public static check(toCheck: unknown | null | undefined, expression: RegExp) {
|
|
132
126
|
const checkResult = REGEX.checkAlgorithm(toCheck, expression);
|
|
133
127
|
|
|
134
128
|
if (typeof checkResult === "string") {
|