xdbc 1.0.217 → 1.0.219

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.
Files changed (120) hide show
  1. package/.gitattributes +16 -8
  2. package/.vscode/settings.json +3 -3
  3. package/.vscode/tasks.json +23 -23
  4. package/ASSESSMENT.md +249 -0
  5. package/README.md +538 -408
  6. package/__tests__/DBC/AE.test.ts +62 -62
  7. package/__tests__/DBC/ARRAY.test.ts +91 -91
  8. package/__tests__/DBC/DEFINED.test.ts +53 -53
  9. package/__tests__/DBC/DOM.test.ts +786 -0
  10. package/__tests__/DBC/Decorators.test.ts +367 -367
  11. package/__tests__/DBC/EQ.test.ts +13 -13
  12. package/__tests__/DBC/GREATER.test.ts +31 -31
  13. package/__tests__/DBC/HasAttribute.test.ts +60 -60
  14. package/__tests__/DBC/IF.test.ts +62 -62
  15. package/__tests__/DBC/INSTANCE.test.ts +13 -13
  16. package/__tests__/DBC/JSON.OP.test.ts +47 -47
  17. package/__tests__/DBC/JSON.Parse.test.ts +17 -17
  18. package/__tests__/DBC/OR.test.ts +14 -14
  19. package/__tests__/DBC/PLAIN_OBJECT.test.ts +109 -109
  20. package/__tests__/DBC/REGEX.test.ts +17 -17
  21. package/__tests__/DBC/TYPE.test.ts +13 -13
  22. package/__tests__/DBC/UNDEFINED.test.ts +45 -45
  23. package/__tests__/DBC/ZOD.test.ts +54 -54
  24. package/__tests__/DBC/onInfringement.test.ts +262 -0
  25. package/biome.json +45 -40
  26. package/dist/DBC/AE.js +172 -0
  27. package/dist/DBC/ARR/PLAIN_OBJECT.d.ts +0 -3
  28. package/dist/DBC/ARR/PLAIN_OBJECT.js +95 -0
  29. package/dist/DBC/ARRAY.d.ts +0 -3
  30. package/dist/DBC/ARRAY.js +90 -0
  31. package/dist/DBC/COMPARISON/GREATER.js +21 -0
  32. package/dist/DBC/COMPARISON/GREATER_OR_EQUAL.js +21 -0
  33. package/dist/DBC/COMPARISON/LESS.js +21 -0
  34. package/dist/DBC/COMPARISON/LESS_OR_EQUAL.js +21 -0
  35. package/dist/DBC/COMPARISON.js +98 -0
  36. package/dist/DBC/DEFINED.js +87 -0
  37. package/dist/DBC/DOM.d.ts +123 -0
  38. package/dist/DBC/DOM.js +362 -0
  39. package/dist/DBC/EQ/DIFFERENT.js +34 -0
  40. package/dist/DBC/EQ.js +101 -0
  41. package/dist/DBC/GREATER.js +99 -0
  42. package/dist/DBC/HasAttribute.js +101 -0
  43. package/dist/DBC/IF.js +96 -0
  44. package/dist/DBC/INSTANCE.js +122 -0
  45. package/dist/DBC/JSON.OP.js +120 -0
  46. package/dist/DBC/JSON.Parse.js +104 -0
  47. package/dist/DBC/OR.js +125 -0
  48. package/dist/DBC/REGEX.js +136 -0
  49. package/dist/DBC/TYPE.js +112 -0
  50. package/dist/DBC/UNDEFINED.js +87 -0
  51. package/dist/DBC/ZOD.js +99 -0
  52. package/dist/DBC.d.ts +18 -4
  53. package/dist/DBC.js +645 -0
  54. package/dist/Demo.d.ts +10 -0
  55. package/dist/Demo.js +713 -0
  56. package/dist/Test.html +18 -0
  57. package/dist/bundle.js +6140 -405
  58. package/dist/index.d.ts +22 -0
  59. package/dist/index.html +18 -0
  60. package/dist/index.js +22 -0
  61. package/docs/assets/highlight.css +22 -22
  62. package/docs/assets/icons.js +17 -17
  63. package/docs/assets/main.js +60 -60
  64. package/docs/assets/style.css +1640 -1640
  65. package/docs/classes/DBC.DBC.html +98 -98
  66. package/docs/classes/DBC_AE.AE.html +160 -160
  67. package/docs/classes/DBC_EQ.EQ.html +131 -131
  68. package/docs/classes/DBC_GREATER.GREATER.html +139 -139
  69. package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -130
  70. package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -138
  71. package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -129
  72. package/docs/classes/DBC_OR.OR.html +137 -137
  73. package/docs/classes/DBC_REGEX.REGEX.html +136 -136
  74. package/docs/classes/DBC_TYPE.TYPE.html +130 -130
  75. package/docs/classes/Demo.Demo.html +14 -14
  76. package/docs/hierarchy.html +1 -1
  77. package/docs/index.html +1 -1
  78. package/docs/modules/DBC.html +1 -1
  79. package/docs/modules/DBC_AE.html +1 -1
  80. package/docs/modules/DBC_EQ.html +1 -1
  81. package/docs/modules/DBC_GREATER.html +1 -1
  82. package/docs/modules/DBC_INSTANCE.html +1 -1
  83. package/docs/modules/DBC_JSON.OP.html +1 -1
  84. package/docs/modules/DBC_JSON.Parse.html +1 -1
  85. package/docs/modules/DBC_OR.html +1 -1
  86. package/docs/modules/DBC_REGEX.html +1 -1
  87. package/docs/modules/DBC_TYPE.html +1 -1
  88. package/docs/modules/Demo.html +1 -1
  89. package/jest.config.js +32 -32
  90. package/package.json +71 -55
  91. package/src/DBC/AE.ts +269 -288
  92. package/src/DBC/ARR/PLAIN_OBJECT.ts +122 -133
  93. package/src/DBC/ARRAY.ts +117 -127
  94. package/src/DBC/COMPARISON/GREATER.ts +41 -46
  95. package/src/DBC/COMPARISON/GREATER_OR_EQUAL.ts +41 -45
  96. package/src/DBC/COMPARISON/LESS.ts +41 -45
  97. package/src/DBC/COMPARISON/LESS_OR_EQUAL.ts +41 -45
  98. package/src/DBC/COMPARISON.ts +149 -159
  99. package/src/DBC/DEFINED.ts +117 -122
  100. package/src/DBC/DOM.ts +453 -0
  101. package/src/DBC/EQ/DIFFERENT.ts +51 -57
  102. package/src/DBC/EQ.ts +154 -163
  103. package/src/DBC/HasAttribute.ts +149 -154
  104. package/src/DBC/IF.ts +173 -179
  105. package/src/DBC/INSTANCE.ts +168 -171
  106. package/src/DBC/JSON.OP.ts +178 -186
  107. package/src/DBC/JSON.Parse.ts +150 -157
  108. package/src/DBC/OR.ts +183 -187
  109. package/src/DBC/REGEX.ts +195 -196
  110. package/src/DBC/TYPE.ts +142 -149
  111. package/src/DBC/UNDEFINED.ts +115 -117
  112. package/src/DBC/ZOD.ts +130 -135
  113. package/src/DBC.ts +902 -904
  114. package/src/Demo.ts +537 -404
  115. package/src/index.ts +22 -0
  116. package/tsconfig.json +18 -18
  117. package/tsconfig.test.json +7 -7
  118. package/typedoc.json +16 -16
  119. package/webpack.config.js +27 -27
  120. package/Assessment.md +0 -507
@@ -1,62 +1,62 @@
1
- import { AE } from "../../src/DBC/AE";
2
- import { EQ } from "../../src/DBC/EQ";
3
- import { REGEX } from "../../src/DBC/REGEX";
4
-
5
- describe("AE", () => {
6
- const ae = new AE([new REGEX(/^a$/), new EQ("a")]);
7
-
8
- test("Should report no infringement with 'a' to check", () => {
9
- expect(ae.check("a" as unknown as object)).toBe(true);
10
- });
11
-
12
- test("Should report no infringement with ['a','a','a'] to check", () => {
13
- expect(ae.check(["a", "a", "a"] as unknown as object)).toBe(true);
14
- });
15
-
16
- test("Should report infringement with ['a','b','a'] to check", () => {
17
- expect(typeof ae.check(["a", "b", "a"] as unknown as object)).toBe(
18
- "string",
19
- );
20
- 1;
21
- });
22
-
23
- test("Should not report infringement with ['b','a','b'] to check when checking only index 1", () => {
24
- expect(
25
- new AE([new REGEX(/^a$/), new EQ("a")], 1).check([
26
- "b",
27
- "a",
28
- "b",
29
- ] as unknown as object),
30
- ).toBe(true);
31
- });
32
-
33
- test("Should report infringement with ['b','a','b'] to check when checking from index 1 on", () => {
34
- expect(
35
- typeof new AE([new REGEX(/^a$/), new EQ("a")], 1, -1).check([
36
- "b",
37
- "a",
38
- "b",
39
- ] as unknown as object),
40
- ).toBe("string");
41
- });
42
-
43
- test("Should not report infringement with ['a','a','b'] to check when checking from index 0 to 1", () => {
44
- expect(
45
- new AE([new REGEX(/^a$/), new EQ("a")], 0, 1).check([
46
- "a",
47
- "a",
48
- "b",
49
- ] as unknown as object),
50
- ).toBe(true);
51
- });
52
-
53
- test("Should report infringement with ['a','a','b'] to check when checking from index 0 to 1 case of EQ-Condition", () => {
54
- expect(
55
- typeof new AE([new REGEX(/^a$/), new EQ("b")], 0, 1).check([
56
- "a",
57
- "a",
58
- "b",
59
- ] as unknown as object),
60
- ).toBe("string");
61
- });
62
- });
1
+ import { AE } from "../../src/DBC/AE";
2
+ import { EQ } from "../../src/DBC/EQ";
3
+ import { REGEX } from "../../src/DBC/REGEX";
4
+
5
+ describe("AE", () => {
6
+ const ae = new AE([new REGEX(/^a$/), new EQ("a")]);
7
+
8
+ test("Should report no infringement with 'a' to check", () => {
9
+ expect(ae.check("a" as unknown as object)).toBe(true);
10
+ });
11
+
12
+ test("Should report no infringement with ['a','a','a'] to check", () => {
13
+ expect(ae.check(["a", "a", "a"] as unknown as object)).toBe(true);
14
+ });
15
+
16
+ test("Should report infringement with ['a','b','a'] to check", () => {
17
+ expect(typeof ae.check(["a", "b", "a"] as unknown as object)).toBe(
18
+ "string",
19
+ );
20
+ 1;
21
+ });
22
+
23
+ test("Should not report infringement with ['b','a','b'] to check when checking only index 1", () => {
24
+ expect(
25
+ new AE([new REGEX(/^a$/), new EQ("a")], 1).check([
26
+ "b",
27
+ "a",
28
+ "b",
29
+ ] as unknown as object),
30
+ ).toBe(true);
31
+ });
32
+
33
+ test("Should report infringement with ['b','a','b'] to check when checking from index 1 on", () => {
34
+ expect(
35
+ typeof new AE([new REGEX(/^a$/), new EQ("a")], 1, -1).check([
36
+ "b",
37
+ "a",
38
+ "b",
39
+ ] as unknown as object),
40
+ ).toBe("string");
41
+ });
42
+
43
+ test("Should not report infringement with ['a','a','b'] to check when checking from index 0 to 1", () => {
44
+ expect(
45
+ new AE([new REGEX(/^a$/), new EQ("a")], 0, 1).check([
46
+ "a",
47
+ "a",
48
+ "b",
49
+ ] as unknown as object),
50
+ ).toBe(true);
51
+ });
52
+
53
+ test("Should report infringement with ['a','a','b'] to check when checking from index 0 to 1 case of EQ-Condition", () => {
54
+ expect(
55
+ typeof new AE([new REGEX(/^a$/), new EQ("b")], 0, 1).check([
56
+ "a",
57
+ "a",
58
+ "b",
59
+ ] as unknown as object),
60
+ ).toBe("string");
61
+ });
62
+ });
@@ -1,91 +1,91 @@
1
- import { ARRAY } from "../../src/DBC/ARRAY";
2
- import { DBC } from "../../src/DBC";
3
-
4
- describe("ARRAY", () => {
5
- const array = new ARRAY();
6
-
7
- test("Should not report infringement with an array", () => {
8
- expect(array.check([1, 2, 3])).toBe(true);
9
- });
10
-
11
- test("Should not report infringement with an empty array", () => {
12
- expect(array.check([])).toBe(true);
13
- });
14
-
15
- test("Should not report infringement with undefined (null-passthrough)", () => {
16
- expect(array.check(undefined)).toBe(true);
17
- });
18
-
19
- test("Should not report infringement with null (null-passthrough)", () => {
20
- expect(array.check(null)).toBe(true);
21
- });
22
-
23
- test("Should report infringement with a plain object", () => {
24
- expect(typeof array.check({})).toBe("string");
25
- });
26
-
27
- test("Should report infringement with a string", () => {
28
- expect(typeof array.check("hello")).toBe("string");
29
- });
30
-
31
- test("Should report infringement with a number", () => {
32
- expect(typeof array.check(42)).toBe("string");
33
- });
34
-
35
- describe("checkAlgorithm", () => {
36
- test("Should return true for an array", () => {
37
- expect(ARRAY.checkAlgorithm([1, 2, 3])).toBe(true);
38
- });
39
-
40
- test("Should return true for an empty array", () => {
41
- expect(ARRAY.checkAlgorithm([])).toBe(true);
42
- });
43
-
44
- test("Should return true for null (null-passthrough)", () => {
45
- expect(ARRAY.checkAlgorithm(null)).toBe(true);
46
- });
47
-
48
- test("Should return true for undefined (null-passthrough)", () => {
49
- expect(ARRAY.checkAlgorithm(undefined)).toBe(true);
50
- });
51
-
52
- test("Should return string for a plain object", () => {
53
- const result = ARRAY.checkAlgorithm({});
54
- expect(typeof result).toBe("string");
55
- expect(result).toContain("ARRAY");
56
- });
57
-
58
- test("Should return string for a string value", () => {
59
- const result = ARRAY.checkAlgorithm("hello");
60
- expect(typeof result).toBe("string");
61
- });
62
-
63
- test("Should return string for a number", () => {
64
- const result = ARRAY.checkAlgorithm(42);
65
- expect(typeof result).toBe("string");
66
- });
67
- });
68
-
69
- describe("tsCheck", () => {
70
- test("Should return the value when it is an array", () => {
71
- const value = [1, 2, 3];
72
- expect(ARRAY.tsCheck(value)).toBe(value);
73
- });
74
-
75
- test("Should throw DBC.Infringement when value is not an array", () => {
76
- expect(() => ARRAY.tsCheck({} as any)).toThrow(DBC.Infringement);
77
- });
78
-
79
- test("Should include hint in the infringement message", () => {
80
- expect(() => ARRAY.tsCheck("oops" as any, "must be an array")).toThrow(
81
- /must be an array/,
82
- );
83
- });
84
-
85
- test("Should include id in the infringement message", () => {
86
- expect(() => ARRAY.tsCheck(42 as any, undefined, "myParam")).toThrow(
87
- /myParam/,
88
- );
89
- });
90
- });
91
- });
1
+ import { DBC } from "../../src/DBC";
2
+ import { ARRAY } from "../../src/DBC/ARRAY";
3
+
4
+ describe("ARRAY", () => {
5
+ const array = new ARRAY();
6
+
7
+ test("Should not report infringement with an array", () => {
8
+ expect(array.check([1, 2, 3])).toBe(true);
9
+ });
10
+
11
+ test("Should not report infringement with an empty array", () => {
12
+ expect(array.check([])).toBe(true);
13
+ });
14
+
15
+ test("Should not report infringement with undefined (null-passthrough)", () => {
16
+ expect(array.check(undefined)).toBe(true);
17
+ });
18
+
19
+ test("Should not report infringement with null (null-passthrough)", () => {
20
+ expect(array.check(null)).toBe(true);
21
+ });
22
+
23
+ test("Should report infringement with a plain object", () => {
24
+ expect(typeof array.check({})).toBe("string");
25
+ });
26
+
27
+ test("Should report infringement with a string", () => {
28
+ expect(typeof array.check("hello")).toBe("string");
29
+ });
30
+
31
+ test("Should report infringement with a number", () => {
32
+ expect(typeof array.check(42)).toBe("string");
33
+ });
34
+
35
+ describe("checkAlgorithm", () => {
36
+ test("Should return true for an array", () => {
37
+ expect(ARRAY.checkAlgorithm([1, 2, 3])).toBe(true);
38
+ });
39
+
40
+ test("Should return true for an empty array", () => {
41
+ expect(ARRAY.checkAlgorithm([])).toBe(true);
42
+ });
43
+
44
+ test("Should return true for null (null-passthrough)", () => {
45
+ expect(ARRAY.checkAlgorithm(null)).toBe(true);
46
+ });
47
+
48
+ test("Should return true for undefined (null-passthrough)", () => {
49
+ expect(ARRAY.checkAlgorithm(undefined)).toBe(true);
50
+ });
51
+
52
+ test("Should return string for a plain object", () => {
53
+ const result = ARRAY.checkAlgorithm({});
54
+ expect(typeof result).toBe("string");
55
+ expect(result).toContain("ARRAY");
56
+ });
57
+
58
+ test("Should return string for a string value", () => {
59
+ const result = ARRAY.checkAlgorithm("hello");
60
+ expect(typeof result).toBe("string");
61
+ });
62
+
63
+ test("Should return string for a number", () => {
64
+ const result = ARRAY.checkAlgorithm(42);
65
+ expect(typeof result).toBe("string");
66
+ });
67
+ });
68
+
69
+ describe("tsCheck", () => {
70
+ test("Should return the value when it is an array", () => {
71
+ const value = [1, 2, 3];
72
+ expect(ARRAY.tsCheck(value)).toBe(value);
73
+ });
74
+
75
+ test("Should throw DBC.Infringement when value is not an array", () => {
76
+ expect(() => ARRAY.tsCheck({} as any)).toThrow(DBC.Infringement);
77
+ });
78
+
79
+ test("Should include hint in the infringement message", () => {
80
+ expect(() => ARRAY.tsCheck("oops" as any, "must be an array")).toThrow(
81
+ /must be an array/,
82
+ );
83
+ });
84
+
85
+ test("Should include id in the infringement message", () => {
86
+ expect(() => ARRAY.tsCheck(42 as any, undefined, "myParam")).toThrow(
87
+ /myParam/,
88
+ );
89
+ });
90
+ });
91
+ });
@@ -1,53 +1,53 @@
1
- import { DEFINED } from "../../src/DBC/DEFINED";
2
-
3
- describe("DEFINED", () => {
4
- const defined = new DEFINED();
5
-
6
- test("Should not report infringement with a string value", () => {
7
- expect(defined.check("hello")).toBe(true);
8
- });
9
-
10
- test("Should not report infringement with a number value", () => {
11
- expect(defined.check(42)).toBe(true);
12
- });
13
-
14
- test("Should not report infringement with an empty string", () => {
15
- expect(defined.check("")).toBe(true);
16
- });
17
-
18
- test("Should not report infringement with zero", () => {
19
- expect(defined.check(0)).toBe(true);
20
- });
21
-
22
- test("Should not report infringement with false", () => {
23
- expect(defined.check(false)).toBe(true);
24
- });
25
-
26
- test("Should report infringement with null", () => {
27
- expect(typeof defined.check(null)).toBe("string");
28
- });
29
-
30
- test("Should report infringement with undefined", () => {
31
- expect(typeof defined.check(undefined)).toBe("string");
32
- });
33
-
34
- describe("checkAlgorithm", () => {
35
- test("Should return true for defined values", () => {
36
- expect(DEFINED.checkAlgorithm("test")).toBe(true);
37
- expect(DEFINED.checkAlgorithm(0)).toBe(true);
38
- expect(DEFINED.checkAlgorithm(false)).toBe(true);
39
- });
40
-
41
- test("Should return string for null", () => {
42
- const result = DEFINED.checkAlgorithm(null);
43
- expect(typeof result).toBe("string");
44
- expect(result).toContain("NULL");
45
- });
46
-
47
- test("Should return string for undefined", () => {
48
- const result = DEFINED.checkAlgorithm(undefined);
49
- expect(typeof result).toBe("string");
50
- expect(result).toContain("UNDEFINED");
51
- });
52
- });
53
- });
1
+ import { DEFINED } from "../../src/DBC/DEFINED";
2
+
3
+ describe("DEFINED", () => {
4
+ const defined = new DEFINED();
5
+
6
+ test("Should not report infringement with a string value", () => {
7
+ expect(defined.check("hello")).toBe(true);
8
+ });
9
+
10
+ test("Should not report infringement with a number value", () => {
11
+ expect(defined.check(42)).toBe(true);
12
+ });
13
+
14
+ test("Should not report infringement with an empty string", () => {
15
+ expect(defined.check("")).toBe(true);
16
+ });
17
+
18
+ test("Should not report infringement with zero", () => {
19
+ expect(defined.check(0)).toBe(true);
20
+ });
21
+
22
+ test("Should not report infringement with false", () => {
23
+ expect(defined.check(false)).toBe(true);
24
+ });
25
+
26
+ test("Should report infringement with null", () => {
27
+ expect(typeof defined.check(null)).toBe("string");
28
+ });
29
+
30
+ test("Should report infringement with undefined", () => {
31
+ expect(typeof defined.check(undefined)).toBe("string");
32
+ });
33
+
34
+ describe("checkAlgorithm", () => {
35
+ test("Should return true for defined values", () => {
36
+ expect(DEFINED.checkAlgorithm("test")).toBe(true);
37
+ expect(DEFINED.checkAlgorithm(0)).toBe(true);
38
+ expect(DEFINED.checkAlgorithm(false)).toBe(true);
39
+ });
40
+
41
+ test("Should return string for null", () => {
42
+ const result = DEFINED.checkAlgorithm(null);
43
+ expect(typeof result).toBe("string");
44
+ expect(result).toContain("NULL");
45
+ });
46
+
47
+ test("Should return string for undefined", () => {
48
+ const result = DEFINED.checkAlgorithm(undefined);
49
+ expect(typeof result).toBe("string");
50
+ expect(result).toContain("UNDEFINED");
51
+ });
52
+ });
53
+ });