xdbc 1.0.108 → 1.0.109
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/EQ.js +17 -0
- package/dist/DBC.js +2 -5
- package/package.json +1 -1
- package/src/DBC/EQ.ts +18 -0
- package/src/DBC.ts +29 -34
package/dist/DBC/EQ.js
CHANGED
|
@@ -86,6 +86,23 @@ export class EQ extends DBC {
|
|
|
86
86
|
check(toCheck) {
|
|
87
87
|
return EQ.checkAlgorithm(toCheck, this.equivalent, this.invert);
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Invokes the {@link EQ.checkAlgorithm } passing the value **toCheck** and the specified **type** .
|
|
91
|
+
*
|
|
92
|
+
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
93
|
+
*
|
|
94
|
+
* @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link EQ }.
|
|
95
|
+
*
|
|
96
|
+
* @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link EQ }.*/
|
|
97
|
+
static tsCheck(toCheck, equivalent) {
|
|
98
|
+
const result = EQ.checkAlgorithm(toCheck, equivalent, false);
|
|
99
|
+
if (result) {
|
|
100
|
+
return toCheck;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new DBC.Infringement(result);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
89
106
|
/**
|
|
90
107
|
* Creates this {@link EQ } by setting the protected property {@link EQ.equivalent } used by {@link EQ.check }.
|
|
91
108
|
*
|
package/dist/DBC.js
CHANGED
|
@@ -70,9 +70,8 @@ export class DBC {
|
|
|
70
70
|
const originalMethod = descriptor.value;
|
|
71
71
|
// biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
|
|
72
72
|
descriptor.value = function (...args) {
|
|
73
|
-
// to correctly capture 'this' from the call site
|
|
74
73
|
// #region Check if a value of one of the method's parameter has been requested and pass it to the
|
|
75
|
-
//
|
|
74
|
+
// receptor, if so.
|
|
76
75
|
if (DBC.paramValueRequests.has(target) &&
|
|
77
76
|
DBC.paramValueRequests.get(target).has(propertyKey)) {
|
|
78
77
|
for (const index of DBC.paramValueRequests
|
|
@@ -89,10 +88,8 @@ export class DBC {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
|
-
// #endregion
|
|
91
|
+
// #endregion Check if a value of one of the method's parameter has been requested and pass it to the
|
|
93
92
|
// receptor, if so.
|
|
94
|
-
// The 'this' here is now the correct 'this' of the instance
|
|
95
|
-
// where the decorated method was called.
|
|
96
93
|
return originalMethod.apply(this, args);
|
|
97
94
|
};
|
|
98
95
|
return descriptor;
|
package/package.json
CHANGED
package/src/DBC/EQ.ts
CHANGED
|
@@ -124,6 +124,24 @@ export class EQ extends DBC {
|
|
|
124
124
|
public check(toCheck: any) {
|
|
125
125
|
return EQ.checkAlgorithm(toCheck, this.equivalent, this.invert);
|
|
126
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Invokes the {@link EQ.checkAlgorithm } passing the value **toCheck** and the specified **type** .
|
|
129
|
+
*
|
|
130
|
+
* @param toCheck See {@link EQ.checkAlgorithm }.
|
|
131
|
+
*
|
|
132
|
+
* @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link EQ }.
|
|
133
|
+
*
|
|
134
|
+
* @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link EQ }.*/
|
|
135
|
+
public static tsCheck<CANDIDATE>( toCheck : CANDIDATE | undefined | null, equivalent : any ) : CANDIDATE {
|
|
136
|
+
const result = EQ.checkAlgorithm(toCheck, equivalent, false );
|
|
137
|
+
|
|
138
|
+
if( result ) {
|
|
139
|
+
return toCheck as CANDIDATE ;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new DBC.Infringement( result as string );
|
|
143
|
+
}
|
|
144
|
+
}
|
|
127
145
|
/**
|
|
128
146
|
* Creates this {@link EQ } by setting the protected property {@link EQ.equivalent } used by {@link EQ.check }.
|
|
129
147
|
*
|
package/src/DBC.ts
CHANGED
|
@@ -92,41 +92,36 @@ export class DBC {
|
|
|
92
92
|
propertyKey: string,
|
|
93
93
|
descriptor: PropertyDescriptor,
|
|
94
94
|
): PropertyDescriptor {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// The 'this' here is now the correct 'this' of the instance
|
|
124
|
-
// where the decorated method was called.
|
|
125
|
-
return originalMethod.apply(this, args);
|
|
126
|
-
};
|
|
95
|
+
const originalMethod = descriptor.value;
|
|
96
|
+
// biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
|
|
97
|
+
descriptor.value = function (...args: any[]) {
|
|
98
|
+
// #region Check if a value of one of the method's parameter has been requested and pass it to the
|
|
99
|
+
// receptor, if so.
|
|
100
|
+
if (
|
|
101
|
+
DBC.paramValueRequests.has(target) &&
|
|
102
|
+
DBC.paramValueRequests.get(target).has(propertyKey)
|
|
103
|
+
) {
|
|
104
|
+
for (const index of DBC.paramValueRequests
|
|
105
|
+
.get(target)
|
|
106
|
+
.get(propertyKey)
|
|
107
|
+
.keys()) {
|
|
108
|
+
if (index < args.length) {
|
|
109
|
+
for (const receptor of DBC.paramValueRequests
|
|
110
|
+
.get(target)
|
|
111
|
+
.get(propertyKey)
|
|
112
|
+
.get(index)) {
|
|
113
|
+
receptor(args[index]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// #endregion Check if a value of one of the method's parameter has been requested and pass it to the
|
|
119
|
+
// receptor, if so.
|
|
120
|
+
return originalMethod.apply(this, args);
|
|
121
|
+
};
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
}
|
|
123
|
+
return descriptor;
|
|
124
|
+
}
|
|
130
125
|
// #endregion Parameter-value requests.
|
|
131
126
|
// #region Class
|
|
132
127
|
/**
|