xdbc 1.0.73

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.
@@ -0,0 +1,103 @@
1
+ import { DBC } from "../DBC.js";
2
+ /**
3
+ * A {@link DBC } providing {@link REGEX }-contracts and standard {@link RegExp } for common use cases in {@link REGEX.stdExp }.
4
+ *
5
+ * @remarks
6
+ * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
7
+ export class REGEX extends DBC {
8
+ // #region Condition checking.
9
+ /**
10
+ * Checks if the value "toCheck" is complies to the {@link RegExp } "expression".
11
+ *
12
+ * @param toCheck The value that has comply to the {@link RegExp } "expression" for this {@link DBC } to be fulfilled.
13
+ * @param expression The {@link RegExp } the one "toCheck" has comply to in order for this {@link DBC } to be
14
+ * fulfilled.
15
+ *
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) {
20
+ if (!expression.test(toCheck)) {
21
+ return `Value has to comply to regular expression "${expression}"`;
22
+ }
23
+ return true;
24
+ }
25
+ /**
26
+ * A parameter-decorator factory using the {@link REGEX.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
27
+ * by the tagged parameter.
28
+ *
29
+ * @param expression See {@link REGEX.checkAlgorithm }.
30
+ * @param path See {@link DBC.decPrecondition }.
31
+ * @param dbc See {@link DBC.decPrecondition }.
32
+ *
33
+ * @returns See {@link DBC.decPrecondition }. */
34
+ static PRE(expression, path = undefined, dbc = "WaXCode.DBC") {
35
+ return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
36
+ return REGEX.checkAlgorithm(value, expression);
37
+ }, dbc, path);
38
+ }
39
+ /**
40
+ * A method-decorator factory using the {@link REGEX.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
41
+ * by the tagged method's returnvalue.
42
+ *
43
+ * @param expression See {@link REGEX.checkAlgorithm }.
44
+ * @param path See {@link DBC.Postcondition }.
45
+ * @param dbc See {@link DBC.decPostcondition }.
46
+ *
47
+ * @returns See {@link DBC.decPostcondition }. */
48
+ static POST(expression, path = undefined, dbc = "WaXCode.DBC") {
49
+ return DBC.decPostcondition(
50
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
51
+ (value, target, propertyKey) => {
52
+ return REGEX.checkAlgorithm(value, expression);
53
+ }, dbc, path);
54
+ }
55
+ // #endregion Condition checking.
56
+ // #region Referenced Condition checking.
57
+ //
58
+ // For usage in dynamic scenarios (like with AE-DBC).
59
+ //
60
+ /**
61
+ * Invokes the {@link EQ.checkAlgorithm } passing the value "toCheck" and {@link EQ.equivalent }.
62
+ *
63
+ * @param toCheck See {@link EQ.checkAlgorithm }.
64
+ *
65
+ * @returns See {@link EQ.checkAlgorithm}. */
66
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
67
+ check(toCheck) {
68
+ return REGEX.checkAlgorithm(toCheck, this.expression);
69
+ }
70
+ /**
71
+ * Creates this {@link REGEX } by setting the protected property {@link REGEX.expression } used by {@link REGEX.check }.
72
+ *
73
+ * @param expression See {@link REGEX.check }. */
74
+ constructor(expression) {
75
+ super();
76
+ this.expression = expression;
77
+ }
78
+ // #endregion Referenced Condition checking.
79
+ // #region In-Method checking.
80
+ /**
81
+ * Invokes the {@link JSON_OP.checkAlgorithm } passing the value "toCheck" and {@link JSON_OP.expression }.
82
+ *
83
+ * @param toCheck See {@link JSON_OP.checkAlgorithm} }.
84
+ * @param expression See {@link JSON_OP.checkAlgorithm} }.
85
+ */
86
+ static check(
87
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
88
+ toCheck, expression) {
89
+ const checkResult = REGEX.checkAlgorithm(toCheck, expression);
90
+ if (typeof checkResult === "string") {
91
+ throw new DBC.Infringement(checkResult);
92
+ }
93
+ }
94
+ }
95
+ /** Stores often used {@link RegExp }s. */
96
+ REGEX.stdExp = {
97
+ property: /^[$_A-Za-z][$_A-Za-z0-9]*$/,
98
+ url: /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/i,
99
+ keyPath: /^([a-zA-Z_$][a-zA-Z0-9_$]*\.)*[a-zA-Z_$][a-zA-Z0-9_$]*$/,
100
+ date: /^\d{1,4}[.\/-]\d{1,2}[.\/-]\d{1,4}$/i,
101
+ dateFormat: /^((D{1,2}[./-]M{1,2}[./-]Y{1,4})|(M{1,2}[./-]D{1,2}[./-]Y{1,4})|Y{1,4}[./-]D{1,2}[./-]M{1,2}|(Y{1,4}[./-]M{1,2}[./-]D{1,2}))$/i,
102
+ cssSelector: /^(?:\*|#[\w-]+|\.[\w-]+|(?:[\w-]+|\*)(?::(?:[\w-]+(?:\([\w-]+\))?)+)?(?:\[(?:[\w-]+(?:(?:=|~=|\|=|\*=|\$=|\^=)\s*(?:"[^"]*"|'[^']*'|[\w-]+)\s*)?)?\])+|\[\s*[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[\w-]+)\s*\])(?:,\s*(?:\*|#[\w-]+|\.[\w-]+|(?:[\w-]+|\*)(?::(?:[\w-]+(?:\([\w-]+\))?)+)?(?:\[(?:[\w-]+(?:(?:=|~=|\|=|\*=|\$=|\^=)\s*(?:"[^"]*"|'[^']*'|[\w-]+)\s*)?)?\])+|\[\s*[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[\w-]+)\s*\]))*$/,
103
+ };
@@ -0,0 +1,75 @@
1
+ import { DBC } from "../DBC.js";
2
+ /**
3
+ * A {@link DBC } defining that the an {@link object }s gotta be of certain {@link TYPE.type }.
4
+ *
5
+ * @remarks
6
+ * Author: Salvatore Callari (Callari@WaXCode.net) / 2025
7
+ * Maintainer: Salvatore Callari (XDBC@WaXCode.net) */
8
+ export class TYPE extends DBC {
9
+ /**
10
+ * Checks if the value "toCheck" is of the "type" specified.
11
+ *
12
+ * @param toCheck The {@link Object } which'S "type" to check.
13
+ * @param type The type the {@link object} "toCheck" has to be of.
14
+ *
15
+ * @returns TRUE if the value "toCheck" is of the specified "type", otherwise FALSE. */
16
+ // biome-ignore lint/suspicious/noExplicitAny: Necessary for dynamic type checking of also UNDEFINED.
17
+ static checkAlgorithm(toCheck, type) {
18
+ // biome-ignore lint/suspicious/useValidTypeof: Necessary
19
+ if (typeof toCheck !== type) {
20
+ return `Value has to to be of type "${type}" but is of type "${typeof toCheck}"`;
21
+ }
22
+ return true;
23
+ }
24
+ /**
25
+ * A parameter-decorator factory using the {@link TYPE.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
26
+ * by the tagged parameter.
27
+ *
28
+ * @param type See {@link TYPE.checkAlgorithm }.
29
+ * @param path See {@link DBC.decPrecondition }.
30
+ * @param dbc See {@link DBC.decPrecondition }.
31
+ *
32
+ * @returns See {@link DBC.decPrecondition }. */
33
+ static PRE(type, path = undefined, dbc = "WaXCode.DBC") {
34
+ return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
35
+ return TYPE.checkAlgorithm(value, type);
36
+ }, dbc, path);
37
+ }
38
+ /**
39
+ * A method-decorator factory using the {@link TYPE.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
40
+ * by the tagged method's returnvalue.
41
+ *
42
+ * @param type See {@link TYPE.checkAlgorithm }.
43
+ * @param path See {@link DBC.Postcondition }.
44
+ * @param dbc See {@link DBC.decPostcondition }.
45
+ *
46
+ * @returns See {@link DBC.decPostcondition }. */
47
+ static POST(type, path = undefined, dbc = "WaXCode.DBC") {
48
+ return DBC.decPostcondition((value, target, propertyKey) => {
49
+ return TYPE.checkAlgorithm(value, type);
50
+ }, dbc, path);
51
+ }
52
+ // #endregion Condition checking.
53
+ // #region Referenced Condition checking.
54
+ //
55
+ // For usage in dynamic scenarios (like with AE-DBC).
56
+ //
57
+ /**
58
+ * Invokes the {@link TYPE.checkAlgorithm } passing the value "toCheck" and the {@link TYPE.type } .
59
+ *
60
+ * @param toCheck See {@link TYPE.checkAlgorithm }.
61
+ *
62
+ * @returns See {@link TYPE.checkAlgorithm}. */
63
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
64
+ check(toCheck) {
65
+ return TYPE.checkAlgorithm(toCheck, this.type);
66
+ }
67
+ /**
68
+ * Creates this {@link TYPE } by setting the protected property {@link TYPE.type } used by {@link TYPE.check }.
69
+ *
70
+ * @param type See {@link TYPE.check }. */
71
+ constructor(type) {
72
+ super();
73
+ this.type = type;
74
+ }
75
+ }
package/dist/DBC.js ADDED
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Provides a [D]esign [B]y [C]ontract Framework using decorators.
3
+ *
4
+ * @remarks
5
+ * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
6
+ export class DBC {
7
+ /**
8
+ * Make a request to get the value of a certain parameter of specific method in a specific {@link object }.
9
+ * That request gets enlisted in {@link paramValueRequests } which is used by {@link ParamvalueProvider} to invoke the
10
+ * given "receptor" with the parameter value stored in there. Thus a parameter decorator using this method will
11
+ * not receive any value of the top method is not tagged with {@link ParamvalueProvider}.
12
+ *
13
+ * @param target The {@link object } containing the method with the parameter which's value is requested.
14
+ * @param methodName The name of the method with the parameter which's value is requested.
15
+ * @param index The index of the parameter which's value is requested.
16
+ * @param receptor The method the requested parameter-value shall be passed to when it becomes available. */
17
+ static requestParamValue(target, methodName, index,
18
+ // biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
19
+ receptor) {
20
+ if (DBC.paramValueRequests.has(target)) {
21
+ if (DBC.paramValueRequests.get(target).has(methodName)) {
22
+ if (DBC.paramValueRequests.get(target).get(methodName).has(index)) {
23
+ DBC.paramValueRequests
24
+ .get(target)
25
+ .get(methodName)
26
+ .get(index)
27
+ .push(receptor);
28
+ }
29
+ else {
30
+ DBC.paramValueRequests
31
+ .get(target)
32
+ .get(methodName)
33
+ .set(index, new Array(receptor));
34
+ }
35
+ }
36
+ else {
37
+ DBC.paramValueRequests
38
+ .get(target)
39
+ .set(methodName, new Map([
40
+ [index, new Array(receptor)],
41
+ ]));
42
+ }
43
+ }
44
+ else {
45
+ DBC.paramValueRequests.set(target, new Map([
46
+ [
47
+ methodName,
48
+ new Map([
49
+ [index, new Array(receptor)],
50
+ ]),
51
+ ],
52
+ ]));
53
+ }
54
+ return undefined;
55
+ }
56
+ /**
57
+ * A method-decorator factory checking the {@link paramValueRequests } for value-requests of the method's parameter.
58
+ * When found it will invoke the "receptor" registered there, inter alia by {@link requestParamValue }, with the
59
+ * parameter's value.
60
+ *
61
+ * @param target The {@link object } hosting the tagged method as provided by the runtime.
62
+ * @param propertyKey The tagged method's name as provided by the runtime.
63
+ * @param descriptor The {@link PropertyDescriptor } as provided by the runtime.
64
+ *
65
+ * @returns The {@link PropertyDescriptor } that was passed by the runtime. */
66
+ static ParamvalueProvider(target, propertyKey, descriptor) {
67
+ const originalMethod = descriptor.value;
68
+ // biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
69
+ descriptor.value = (...args) => {
70
+ // #region Check if a value of one of the method's parameter has been requested and pass it to the
71
+ // receptor, if so.
72
+ if (DBC.paramValueRequests.has(target) &&
73
+ DBC.paramValueRequests.get(target).has(propertyKey)) {
74
+ for (const index of DBC.paramValueRequests
75
+ .get(target)
76
+ .get(propertyKey)
77
+ .keys()) {
78
+ if (index < args.length) {
79
+ for (const receptor of DBC.paramValueRequests
80
+ .get(target)
81
+ .get(propertyKey)
82
+ .get(index)) {
83
+ receptor(args[index]);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ // #endregion Check if a value of one of the method's parameter has been requested and pass it to the
89
+ // receptor, if so.
90
+ // biome-ignore lint/complexity/noThisInStatic: <explanation>
91
+ return originalMethod.apply(this, args);
92
+ };
93
+ return descriptor;
94
+ }
95
+ // #endregion Parameter-value requests.
96
+ // #region Postcondition
97
+ /**
98
+ *
99
+ * @param check
100
+ * @param dbc
101
+ * @param path
102
+ * @returns
103
+ */
104
+ static decPostcondition(
105
+ // biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
106
+ check, dbc, path = undefined) {
107
+ return (target, propertyKey, descriptor) => {
108
+ const originalMethod = descriptor.value;
109
+ // biome-ignore lint/suspicious/noExplicitAny: Gotta be any since parameter-values may be undefined.
110
+ descriptor.value = (...args) => {
111
+ // biome-ignore lint/complexity/noThisInStatic: <explanation>
112
+ const result = originalMethod.apply(this, args);
113
+ const realValue = path
114
+ ? path === null || path === void 0 ? void 0 : path.split(".").reduce((accumulator, current) => accumulator[current], result)
115
+ : result;
116
+ const checkResult = check(realValue, target, propertyKey);
117
+ if (typeof checkResult === "string") {
118
+ DBC.resolveDBCPath(window, dbc).reportReturnvalueInfringement(checkResult, target, path, propertyKey, realValue);
119
+ }
120
+ return result;
121
+ };
122
+ return descriptor;
123
+ };
124
+ }
125
+ // #endregion Postcondition
126
+ // #region Decorator
127
+ // #region Parameter
128
+ /**
129
+ * A parameter-decorator factory that requests the tagged parameter's value passing it to the provided
130
+ * "check"-method when the value becomes available.
131
+ *
132
+ * @param check The "( unknown ) => void" to be invoked along with the tagged parameter's value as soon
133
+ * as it becomes available.
134
+ * @param path The dotted path referring to the actual value to check, starting form the specified one.
135
+ * @param dbc See {@link DBC.resolveDBCPath }.
136
+ *
137
+ * @returns The { (target: object, methodName: string | symbol, parameterIndex: number ) => void } invoked by Typescript- */
138
+ static decPrecondition(check, dbc, path = undefined) {
139
+ return (target, methodName, parameterIndex) => {
140
+ DBC.requestParamValue(target, methodName, parameterIndex, (value) => {
141
+ const realValue = path
142
+ ? path === null || path === void 0 ? void 0 : path.split(".").reduce((accumulator, current) => accumulator[current], value)
143
+ : value;
144
+ const result = check(realValue, target, methodName, parameterIndex);
145
+ if (typeof result === "string") {
146
+ DBC.resolveDBCPath(window, dbc).reportParameterInfringement(result, target, path, methodName, parameterIndex, realValue);
147
+ }
148
+ });
149
+ };
150
+ }
151
+ /**
152
+ * Reports a warning.
153
+ *
154
+ * @param message The message containing the warning. */
155
+ reportWarning(message) {
156
+ if (this.warningSettings.logToConsole) {
157
+ console.warn(message);
158
+ }
159
+ }
160
+ /**
161
+ * Reports an infringement according to the {@link infringementSettings } also generating a proper {@link string }-wrapper
162
+ * for the given "message" & violator.
163
+ *
164
+ * @param message The {@link string } describing the infringement and it's provenience.
165
+ * @param violator The {@link string } describing or naming the violator. */
166
+ reportInfringement(message, violator, target, path) {
167
+ const finalMessage = `[ From "${violator}"${path ? `'s member "${path}"` : ""}${typeof target === "function" ? ` in "${target.name}"` : typeof target === "object" && target !== null && typeof target.constructor === "function" ? ` in "${target.constructor.name}"` : ""}: ${message}]`;
168
+ if (this.infringementSettings.throwException) {
169
+ throw new DBC.Infringement(finalMessage);
170
+ }
171
+ if (this.infringementSettings.logToConsole) {
172
+ console.log(finalMessage);
173
+ }
174
+ }
175
+ /**
176
+ * Reports a parameter-infringement according via {@link reportInfringement } also generating a proper {@link string }-wrapper
177
+ * for the given "message","method", parameter-"index" & value.
178
+ *
179
+ * @param message The {@link string } describing the infringement and it's provenience.
180
+ * @param method The {@link string } describing or naming the violator.
181
+ * @param index The index of the parameter within the argument listing.
182
+ * @param value The parameter's value. */
183
+ reportParameterInfringement(message, target, path, method, index, value) {
184
+ const properIndex = index + 1;
185
+ this.reportInfringement(`[ Parameter-value "${value}" of the ${properIndex}${properIndex === 1 ? "st" : properIndex === 2 ? "nd" : properIndex === 3 ? "rd" : "th"} parameter did not fulfill one of it's contracts: ${message}]`, method, target, path);
186
+ }
187
+ /**
188
+ * Reports a returnvalue-infringement according via {@link reportInfringement } also generating a proper {@link string }-wrapper
189
+ * for the given "message","method" & value.
190
+ *
191
+ * @param message The {@link string } describing the infringement and it's provenience.
192
+ * @param method The {@link string } describing or naming the violator.
193
+ * @param value The parameter's value. */
194
+ reportReturnvalueInfringement(message, target, path, method,
195
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
196
+ value) {
197
+ this.reportInfringement(`[ Return-value "${value}" did not fulfill one of it's contracts: ${message}]`, method, target, path);
198
+ }
199
+ /**
200
+ *
201
+ * @param infringementSettings
202
+ */
203
+ constructor(infringementSettings = { throwException: true, logToConsole: false }) {
204
+ // #endregion Parameter
205
+ // #endregion Decorator
206
+ // #region Warning handling.
207
+ /** Stores settings concerning warnings. */
208
+ this.warningSettings = { logToConsole: true };
209
+ // #endregion Warning handling.
210
+ // #region infringement handling.
211
+ /** Stores the setting concerning infringements */
212
+ this.infringementSettings = { throwException: true, logToConsole: false };
213
+ this.infringementSettings = infringementSettings;
214
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
215
+ if (window.WaXCode === undefined)
216
+ window.WaXCode = {};
217
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
218
+ window.WaXCode.DBC = this;
219
+ }
220
+ }
221
+ // #region Parameter-value requests.
222
+ /** Stores all request for parameter values registered by {@link decPrecondition }. */
223
+ DBC.paramValueRequests = new Map();
224
+ // #region Classes
225
+ // #region Errors
226
+ /** An {@link Error } to be thrown whenever an infringement is detected. */
227
+ DBC.Infringement = class extends Error {
228
+ /**
229
+ * Constructs this {@link Error } by tagging the specified message-{@link string } as an XDBC-Infringement.
230
+ *
231
+ * @param message The {@link string } describing the infringement. */
232
+ constructor(message) {
233
+ super(`[ XDBC Infringement ${message}]`);
234
+ }
235
+ };
236
+ // #endregion Errors
237
+ // #endregion Classes
238
+ // #endregion infringement handling.
239
+ DBC.resolveDBCPath = (obj, path) => path === null || path === void 0 ? void 0 : path.split(".").reduce((accumulator, current) => accumulator[current], obj);
240
+ new DBC();
@@ -0,0 +1,2 @@
1
+ // @ts-nocheck
2
+ export class DBC{constructor(){this.g=0}static decPrecondition(t){return(t,e,o)=>{console.log(`X:${DBC.parameterValues.get(t).get(e)}`),console.log(t)}}static log(t,e,o){const n=o.value;return o.value=function(...o){console.log(`Calling ${t.constructor.name}.${e} with arguments: ${JSON.stringify(o)}`);const s=n.apply(this,o);return console.log(`Result: ${s}`),s},o}}DBC.parameterValues=new Map;
package/dist/test.js ADDED
@@ -0,0 +1,110 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { DBC } from "./DBC.js";
14
+ import { REGEX } from "./DBC/REGEX.js";
15
+ import { EQ } from "./DBC/EQ.js";
16
+ import { TYPE } from "./DBC/TYPE.js";
17
+ import { AE } from "./DBC/AE.js";
18
+ import { INSTANCE } from "./DBC/INSTANCE.js";
19
+ export class Calculator {
20
+ divide(a, b) {
21
+ console.log(a);
22
+ return a;
23
+ }
24
+ HT(o) { }
25
+ type(o) { }
26
+ array(x) { }
27
+ regex(x) { }
28
+ index(x) { }
29
+ instance(candidate) { }
30
+ range(x) { }
31
+ // biome-ignore lint/suspicious/noExplicitAny: Test
32
+ invert(g) {
33
+ return null;
34
+ }
35
+ }
36
+ __decorate([
37
+ REGEX.POST(/xxxx*/g),
38
+ DBC.ParamvalueProvider,
39
+ __param(0, REGEX.PRE(/holla*/g)),
40
+ __metadata("design:type", Function),
41
+ __metadata("design:paramtypes", [String, Number]),
42
+ __metadata("design:returntype", String)
43
+ ], Calculator.prototype, "divide", null);
44
+ __decorate([
45
+ DBC.ParamvalueProvider,
46
+ __param(0, EQ.PRE("SELECT", true, "tagName")),
47
+ __metadata("design:type", Function),
48
+ __metadata("design:paramtypes", [HTMLElement]),
49
+ __metadata("design:returntype", void 0)
50
+ ], Calculator.prototype, "HT", null);
51
+ __decorate([
52
+ DBC.ParamvalueProvider,
53
+ __param(0, TYPE.PRE("string")),
54
+ __metadata("design:type", Function),
55
+ __metadata("design:paramtypes", [Object]),
56
+ __metadata("design:returntype", void 0)
57
+ ], Calculator.prototype, "type", null);
58
+ __decorate([
59
+ DBC.ParamvalueProvider,
60
+ __param(0, AE.PRE([new TYPE("string")])),
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", [Array]),
63
+ __metadata("design:returntype", void 0)
64
+ ], Calculator.prototype, "array", null);
65
+ __decorate([
66
+ DBC.ParamvalueProvider,
67
+ __param(0, AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i))),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [Array]),
70
+ __metadata("design:returntype", void 0)
71
+ ], Calculator.prototype, "regex", null);
72
+ __decorate([
73
+ DBC.ParamvalueProvider,
74
+ __param(0, AE.PRE(new REGEX(/^\d$/i), 0)),
75
+ __param(0, AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i), 1)),
76
+ __metadata("design:type", Function),
77
+ __metadata("design:paramtypes", [Array]),
78
+ __metadata("design:returntype", void 0)
79
+ ], Calculator.prototype, "index", null);
80
+ __decorate([
81
+ DBC.ParamvalueProvider
82
+ // biome-ignore lint/suspicious/noExplicitAny: Test
83
+ ,
84
+ __param(0, INSTANCE.PRE(Date)),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [Object]),
87
+ __metadata("design:returntype", void 0)
88
+ ], Calculator.prototype, "instance", null);
89
+ __decorate([
90
+ DBC.ParamvalueProvider,
91
+ __param(0, AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2)),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [Array]),
94
+ __metadata("design:returntype", void 0)
95
+ ], Calculator.prototype, "range", null);
96
+ __decorate([
97
+ AE.POST(new EQ(null, true), 0),
98
+ __metadata("design:type", Function),
99
+ __metadata("design:paramtypes", [String]),
100
+ __metadata("design:returntype", void 0)
101
+ ], Calculator.prototype, "invert", null);
102
+ console.log("s");
103
+ //new Calculator().divide("xxxx", 1);
104
+ //new Calculator().HT(document.createElement("select"));
105
+ //new Calculator().type("10");
106
+ //new Calculator().array([11, "10", "b"]);
107
+ //new Calculator().index(["1a", "+d1m", "-x10y"]);
108
+ //new Calculator().instance(new Date());
109
+ //new Calculator().range([11, "abc", "abc"]);
110
+ new Calculator().invert("");
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": "1.0.73",
3
+ "name": "xdbc",
4
+ "scripts": {
5
+ "format": "biome format ./src --write",
6
+ "lint": "biome check ./",
7
+ "ci": "biome ci ./"
8
+ },
9
+ "devDependencies": {
10
+ "@types/express": "^5.0.1"
11
+ },
12
+ "dependencies": {
13
+ "undici-types": "^7.7.0"
14
+ },
15
+ "description": "A Typescript Design by Contract Framework",
16
+ "main": "test.js",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/CallariS/XDBC.git"
20
+ },
21
+ "keywords": ["DbC", "DesignByContract", "Typescript"],
22
+ "author": "Callari, Salvatore",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/CallariS/XDBC/issues"
26
+ },
27
+ "homepage": "https://github.com/CallariS/XDBC#readme"
28
+ }