xdbc 1.0.197 → 1.0.199

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/Assessment.md ADDED
@@ -0,0 +1,51 @@
1
+ # Project Assessment: XDBC
2
+
3
+ ## Summary
4
+ XDBC is a TypeScript design-by-contract framework with a clear conceptual model and a consistent decorator-based API. The project shows thoughtful structure, working tests for core contracts, and published documentation. Code quality is solid overall, with a few correctness inconsistencies and platform assumptions that should be addressed to raise maturity.
5
+
6
+ ## Code Quality
7
+ **Strengths**
8
+ - Consistent contract pattern across modules (`PRE`, `POST`, `INVARIANT`) improves readability and discoverability.
9
+ - Clear separation between decorator wiring in `DBC` and contract logic in individual classes.
10
+ - Error reporting is standardized via a shared infringement mechanism.
11
+ - Tests exist for multiple contracts and check algorithms, providing a baseline safety net.
12
+
13
+ **Areas to improve**
14
+ - Some parameter-ordering and argument-passing inconsistencies appear in comparison-related contracts, which can lead to incorrect behavior in edge cases.
15
+ - Several APIs use `any` for contract evaluation, reducing type-safety and increasing the chance of runtime errors.
16
+ - Some internal operations depend on `window`, limiting portability to non-browser runtimes unless `globalThis` is used or abstraction is added.
17
+
18
+ ## Code Maturity
19
+ **Strengths**
20
+ - Established package structure with test suite, docs, and build tooling.
21
+ - API documentation is published and referenced in the README.
22
+ - Versioning indicates active iteration and maintenance.
23
+
24
+ **Areas to improve**
25
+ - Tests mostly cover direct `check()` usage rather than decorator execution flows and global instance resolution. Decorator behavior is the primary value proposition and should be exercised in tests.
26
+ - Minor logic issues in comparison helpers suggest a need for more thorough regression tests.
27
+ - Type definitions could be tightened to reduce ambiguous usage patterns.
28
+
29
+ ## Professionalism
30
+ **Strengths**
31
+ - Clear repository metadata (license, contribution guide, security policy).
32
+ - Consistent naming and documentation comments across modules.
33
+ - Public API is documented and examples are provided.
34
+
35
+ **Areas to improve**
36
+ - Logging on hot paths and in disabled-check branches can be noisy in production; prefer opt-in debug logging.
37
+ - Ensure consistent parameter ordering across derived contracts to preserve reliability and reduce maintenance risk.
38
+
39
+ ## Recommendations
40
+ 1. Add decorator-focused tests for `PRE`, `POST`, and `INVARIANT` to validate runtime behavior and error reporting.
41
+ 2. Normalize parameter order across comparison-related contracts and add regression tests.
42
+ 3. Replace direct `window` usage with `globalThis` or a host abstraction to improve portability.
43
+ 4. Reduce `any` usage in public APIs with generics or union types where feasible.
44
+ 5. Provide a production-mode option that strips or short-circuits checks cleanly to improve performance.
45
+
46
+ ## Overall Assessment
47
+ - **Code quality:** Good, with a few correctness edge cases.
48
+ - **Code maturity:** Moderate; strong structure but missing deeper decorator coverage.
49
+ - **Professionalism:** Good; strong docs and repo hygiene.
50
+
51
+ With the recommended refinements, XDBC is well-positioned to be a mature and reliable contract framework for TypeScript projects.
package/Test.html CHANGED
@@ -8,7 +8,7 @@
8
8
  <body>
9
9
  <h1>Loading test.js Script</h1>
10
10
 
11
- <script src="bundle.js" type="module"></script>
11
+ <script src="dist/bundle.js" type="module"></script>
12
12
  <script>
13
13
 
14
14
  </script>
@@ -1,99 +1,99 @@
1
- import { DBC } from "../DBC";
2
- /**
3
- * A {@link DBC } defining a comparison between two {@link object }s.
4
- *
5
- * @remarks
6
- * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
7
- export class COMPARISON extends DBC {
8
- // #region Condition checking.
9
- /**
10
- * Does a comparison between the {@link object } **toCheck** and the **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 has 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 has to be less than "${equivalent}"`;
29
- }
30
- return true;
31
- }
32
- /**
33
- * A parameter-decorator factory using the {@link COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
34
- * by the tagged parameter.
35
- *
36
- * @param equivalent See {@link COMPARISON.checkAlgorithm }.
37
- * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
49
- * by the tagged method's returnvalue.
50
- *
51
- * @param equivalent See {@link COMPARISON.checkAlgorithm }.
52
- * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
64
- * by the tagged field.
65
- *
66
- * @param equivalent See {@link COMPARISON.checkAlgorithm }.
67
- * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } passing the value **toCheck**, {@link COMPARISON.equivalent } and {@link COMPARISON.invert }.
80
- *
81
- * @param toCheck See {@link COMPARISON.checkAlgorithm }.
82
- *
83
- * @returns See {@link COMPARISON.checkAlgorithm}. */
84
- check(toCheck) {
85
- return COMPARISON.checkAlgorithm(toCheck, this.equivalent, this.equalityPermitted, this.invert);
86
- }
87
- /**
88
- * Creates this {@link COMPARISON } by setting the protected property {@link COMPARISON.equivalent }, {@link COMPARISON.equalityPermitted } and {@link COMPARISON.invert } used by {@link COMPARISON.check }.
89
- *
90
- * @param equivalent See {@link COMPARISON.check }.
91
- * @param equalityPermitted See {@link COMPARISON.check }.
92
- * @param invert See {@link COMPARISON.check }. */
93
- constructor(equivalent, equalityPermitted = false, invert = false) {
94
- super();
95
- this.equivalent = equivalent;
96
- this.equalityPermitted = equalityPermitted;
97
- this.invert = invert;
98
- }
99
- }
1
+ import { DBC } from "../DBC";
2
+ /**
3
+ * A {@link DBC } defining a comparison between two {@link object }s.
4
+ *
5
+ * @remarks
6
+ * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
7
+ export class COMPARISON extends DBC {
8
+ // #region Condition checking.
9
+ /**
10
+ * Does a comparison between the {@link object } **toCheck** and the **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 COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
34
+ * by the tagged parameter.
35
+ *
36
+ * @param equivalent See {@link COMPARISON.checkAlgorithm }.
37
+ * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
49
+ * by the tagged method's returnvalue.
50
+ *
51
+ * @param equivalent See {@link COMPARISON.checkAlgorithm }.
52
+ * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
64
+ * by the tagged field.
65
+ *
66
+ * @param equivalent See {@link COMPARISON.checkAlgorithm }.
67
+ * @param equalityPermitted See {@link COMPARISON.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 COMPARISON.checkAlgorithm } passing the value **toCheck**, {@link COMPARISON.equivalent } and {@link COMPARISON.invert }.
80
+ *
81
+ * @param toCheck See {@link COMPARISON.checkAlgorithm }.
82
+ *
83
+ * @returns See {@link COMPARISON.checkAlgorithm}. */
84
+ check(toCheck) {
85
+ return COMPARISON.checkAlgorithm(toCheck, this.equivalent, this.equalityPermitted, this.invert);
86
+ }
87
+ /**
88
+ * Creates this {@link COMPARISON } by setting the protected property {@link COMPARISON.equivalent }, {@link COMPARISON.equalityPermitted } and {@link COMPARISON.invert } used by {@link COMPARISON.check }.
89
+ *
90
+ * @param equivalent See {@link COMPARISON.check }.
91
+ * @param equalityPermitted See {@link COMPARISON.check }.
92
+ * @param invert See {@link COMPARISON.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,117 +1,100 @@
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 EQ extends DBC {
8
- // #region Condition checking.
9
- /**
10
- * Checks if the value **toCheck** is 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(
18
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
19
- toCheck, equivalent, invert) {
20
- if (!invert && equivalent !== toCheck) {
21
- return `Value has to to be equal to "${equivalent}"`;
22
- }
23
- if (invert && equivalent === toCheck) {
24
- return `Value must not to be equal to "${equivalent}"`;
25
- }
26
- return true;
27
- }
28
- /**
29
- * A parameter-decorator factory using the {@link EQ.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
30
- * by the tagged parameter.
31
- *
32
- * @param equivalent See {@link EQ.checkAlgorithm }.
33
- * @param path See {@link DBC.decPrecondition }.
34
- * @param dbc See {@link DBC.decPrecondition }.
35
- *
36
- * @returns See {@link DBC.decPrecondition }. */
37
- static PRE(
38
- // biome-ignore lint/suspicious/noExplicitAny: To check for UNDEFINED and NULL.
39
- equivalent, invert = false, path = undefined, dbc = "WaXCode.DBC") {
40
- return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
41
- return EQ.checkAlgorithm(value, equivalent, invert);
42
- }, dbc, path);
43
- }
44
- /**
45
- * A method-decorator factory using the {@link EQ.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
46
- * by the tagged method's returnvalue.
47
- *
48
- * @param equivalent See {@link EQ.checkAlgorithm }.
49
- * @param path See {@link DBC.Postcondition }.
50
- * @param dbc See {@link DBC.decPostcondition }.
51
- *
52
- * @returns See {@link DBC.decPostcondition }. */
53
- static POST(
54
- // biome-ignore lint/suspicious/noExplicitAny: To check for UNDEFINED and NULL.
55
- equivalent, invert = false, path = undefined, dbc = "WaXCode.DBC") {
56
- return DBC.decPostcondition((value, target, propertyKey) => {
57
- return EQ.checkAlgorithm(value, equivalent, invert);
58
- }, dbc, path);
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
- }
74
- // #endregion Condition checking.
75
- // #region Referenced Condition checking.
76
- //
77
- // For usage in dynamic scenarios (like with AE-DBC).
78
- //
79
- /**
80
- * Invokes the {@link EQ.checkAlgorithm } passing the value **toCheck**, {@link EQ.equivalent } and {@link EQ.invert }.
81
- *
82
- * @param toCheck See {@link EQ.checkAlgorithm }.
83
- *
84
- * @returns See {@link EQ.checkAlgorithm}. */
85
- // biome-ignore lint/suspicious/noExplicitAny: Necessary to check against NULL & UNDEFINED.
86
- check(toCheck) {
87
- return EQ.checkAlgorithm(toCheck, this.equivalent, this.invert);
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
- }
106
- /**
107
- * Creates this {@link EQ } by setting the protected property {@link EQ.equivalent } used by {@link EQ.check }.
108
- *
109
- * @param equivalent See {@link EQ.check }. */
110
- constructor(
111
- // biome-ignore lint/suspicious/noExplicitAny: To be able to match UNDEFINED and NULL.
112
- equivalent, invert = false) {
113
- super();
114
- this.equivalent = equivalent;
115
- this.invert = invert;
116
- }
117
- }
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 EQ extends DBC {
8
+ // #region Condition checking.
9
+ /**
10
+ * Checks if the value **toCheck** is 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(
18
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
19
+ toCheck, equivalent, invert) {
20
+ if (!invert && equivalent !== toCheck) {
21
+ return `Value has to to be equal to "${equivalent}"`;
22
+ }
23
+ if (invert && equivalent === toCheck) {
24
+ return `Value must not to be equal to "${equivalent}"`;
25
+ }
26
+ return true;
27
+ }
28
+ /**
29
+ * A parameter-decorator factory using the {@link EQ.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
30
+ * by the tagged parameter.
31
+ *
32
+ * @param equivalent See {@link EQ.checkAlgorithm }.
33
+ * @param path See {@link DBC.decPrecondition }.
34
+ * @param dbc See {@link DBC.decPrecondition }.
35
+ *
36
+ * @returns See {@link DBC.decPrecondition }. */
37
+ static PRE(
38
+ // biome-ignore lint/suspicious/noExplicitAny: To check for UNDEFINED and NULL.
39
+ equivalent, invert = false, path = undefined, dbc = "WaXCode.DBC") {
40
+ return DBC.decPrecondition((value, target, methodName, parameterIndex) => {
41
+ return EQ.checkAlgorithm(value, equivalent, invert);
42
+ }, dbc, path);
43
+ }
44
+ /**
45
+ * A method-decorator factory using the {@link EQ.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
46
+ * by the tagged method's returnvalue.
47
+ *
48
+ * @param equivalent See {@link EQ.checkAlgorithm }.
49
+ * @param path See {@link DBC.Postcondition }.
50
+ * @param dbc See {@link DBC.decPostcondition }.
51
+ *
52
+ * @returns See {@link DBC.decPostcondition }. */
53
+ static POST(
54
+ // biome-ignore lint/suspicious/noExplicitAny: To check for UNDEFINED and NULL.
55
+ equivalent, invert = false, path = undefined, dbc = "WaXCode.DBC") {
56
+ return DBC.decPostcondition((value, target, propertyKey) => {
57
+ return EQ.checkAlgorithm(value, equivalent, invert);
58
+ }, dbc, path);
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
+ }
74
+ // #endregion Condition checking.
75
+ // #region Referenced Condition checking.
76
+ //
77
+ // For usage in dynamic scenarios (like with AE-DBC).
78
+ //
79
+ /**
80
+ * Invokes the {@link EQ.checkAlgorithm } passing the value **toCheck**, {@link EQ.equivalent } and {@link EQ.invert }.
81
+ *
82
+ * @param toCheck See {@link EQ.checkAlgorithm }.
83
+ *
84
+ * @returns See {@link EQ.checkAlgorithm}. */
85
+ // biome-ignore lint/suspicious/noExplicitAny: Necessary to check against NULL & UNDEFINED.
86
+ check(toCheck) {
87
+ return EQ.checkAlgorithm(toCheck, this.equivalent, this.invert);
88
+ }
89
+ /**
90
+ * Creates this {@link EQ } by setting the protected property {@link EQ.equivalent } used by {@link EQ.check }.
91
+ *
92
+ * @param equivalent See {@link EQ.check }. */
93
+ constructor(
94
+ // biome-ignore lint/suspicious/noExplicitAny: To be able to match UNDEFINED and NULL.
95
+ equivalent, invert = false) {
96
+ super();
97
+ this.equivalent = equivalent;
98
+ this.invert = invert;
99
+ }
100
+ }