xdbc 1.0.216 → 1.0.218

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 (99) hide show
  1. package/.gitattributes +8 -0
  2. package/.vscode/settings.json +3 -3
  3. package/.vscode/tasks.json +23 -23
  4. package/ASSESSMENT.md +249 -0
  5. package/README.md +133 -1
  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 +481 -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 +40 -40
  26. package/dist/DBC/AE.js +172 -0
  27. package/dist/DBC/ARR/PLAIN_OBJECT.d.ts +1 -4
  28. package/dist/DBC/ARR/PLAIN_OBJECT.js +95 -0
  29. package/dist/DBC/ARRAY.d.ts +1 -4
  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.d.ts +1 -1
  37. package/dist/DBC/DEFINED.js +87 -0
  38. package/dist/DBC/DOM.d.ts +87 -0
  39. package/dist/DBC/DOM.js +223 -0
  40. package/dist/DBC/EQ/DIFFERENT.js +34 -0
  41. package/dist/DBC/EQ.d.ts +1 -1
  42. package/dist/DBC/EQ.js +101 -0
  43. package/dist/DBC/HasAttribute.js +101 -0
  44. package/dist/DBC/IF.js +96 -0
  45. package/dist/DBC/INSTANCE.d.ts +2 -2
  46. package/dist/DBC/INSTANCE.js +122 -0
  47. package/dist/DBC/JSON.OP.d.ts +1 -1
  48. package/dist/DBC/JSON.OP.js +120 -0
  49. package/dist/DBC/JSON.Parse.d.ts +1 -1
  50. package/dist/DBC/JSON.Parse.js +104 -0
  51. package/dist/DBC/OR.d.ts +1 -1
  52. package/dist/DBC/OR.js +125 -0
  53. package/dist/DBC/REGEX.d.ts +2 -2
  54. package/dist/DBC/REGEX.js +136 -0
  55. package/dist/DBC/TYPE.d.ts +1 -1
  56. package/dist/DBC/TYPE.js +112 -0
  57. package/dist/DBC/UNDEFINED.d.ts +1 -1
  58. package/dist/DBC/UNDEFINED.js +87 -0
  59. package/dist/DBC/ZOD.d.ts +1 -1
  60. package/dist/DBC/ZOD.js +99 -0
  61. package/dist/DBC.d.ts +26 -3
  62. package/dist/DBC.js +645 -0
  63. package/dist/Demo.d.ts +10 -0
  64. package/dist/Demo.js +713 -0
  65. package/dist/bundle.js +6174 -412
  66. package/dist/index.d.ts +22 -0
  67. package/dist/index.js +22 -0
  68. package/jest.config.js +32 -32
  69. package/package.json +71 -55
  70. package/src/DBC/AE.ts +269 -288
  71. package/src/DBC/ARR/PLAIN_OBJECT.ts +122 -130
  72. package/src/DBC/ARRAY.ts +117 -124
  73. package/src/DBC/COMPARISON/GREATER.ts +41 -46
  74. package/src/DBC/COMPARISON/GREATER_OR_EQUAL.ts +41 -45
  75. package/src/DBC/COMPARISON/LESS.ts +41 -45
  76. package/src/DBC/COMPARISON/LESS_OR_EQUAL.ts +41 -45
  77. package/src/DBC/COMPARISON.ts +149 -159
  78. package/src/DBC/DEFINED.ts +117 -119
  79. package/src/DBC/DOM.ts +291 -0
  80. package/src/DBC/EQ/DIFFERENT.ts +51 -57
  81. package/src/DBC/EQ.ts +154 -160
  82. package/src/DBC/HasAttribute.ts +149 -154
  83. package/src/DBC/IF.ts +173 -179
  84. package/src/DBC/INSTANCE.ts +168 -167
  85. package/src/DBC/JSON.OP.ts +178 -185
  86. package/src/DBC/JSON.Parse.ts +150 -156
  87. package/src/DBC/OR.ts +183 -184
  88. package/src/DBC/REGEX.ts +195 -193
  89. package/src/DBC/TYPE.ts +142 -146
  90. package/src/DBC/UNDEFINED.ts +115 -115
  91. package/src/DBC/ZOD.ts +130 -133
  92. package/src/DBC.ts +902 -877
  93. package/src/Demo.ts +537 -404
  94. package/src/index.ts +22 -0
  95. package/tsconfig.json +18 -18
  96. package/tsconfig.test.json +7 -7
  97. package/typedoc.json +16 -16
  98. package/webpack.config.js +27 -27
  99. package/Assessment.md +0 -507
@@ -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
+ });