xdbc 1.0.210 → 1.0.212

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 (68) hide show
  1. package/.gitattributes +8 -0
  2. package/.github/workflows/ci.yml +51 -0
  3. package/.vscode/tasks.json +23 -23
  4. package/CODE_OF_CONDUCT.md +1 -1
  5. package/README.md +1 -0
  6. package/__tests__/DBC/AE.test.ts +1 -1
  7. package/__tests__/DBC/DEFINED.test.ts +49 -49
  8. package/__tests__/DBC/Decorators.test.ts +334 -332
  9. package/__tests__/DBC/HasAttribute.test.ts +56 -52
  10. package/__tests__/DBC/IF.test.ts +57 -55
  11. package/__tests__/DBC/OR.test.ts +1 -1
  12. package/__tests__/DBC/REGEX.test.ts +4 -0
  13. package/__tests__/DBC/UNDEFINED.test.ts +41 -41
  14. package/__tests__/DBC/ZOD.test.ts +50 -50
  15. package/biome.json +40 -33
  16. package/dist/bundle.js +2297 -0
  17. package/docs/assets/highlight.css +22 -22
  18. package/docs/assets/icons.js +17 -17
  19. package/docs/assets/main.js +60 -60
  20. package/docs/assets/style.css +1640 -1640
  21. package/docs/classes/DBC.DBC.html +98 -98
  22. package/docs/classes/DBC_AE.AE.html +160 -160
  23. package/docs/classes/DBC_EQ.EQ.html +131 -131
  24. package/docs/classes/DBC_GREATER.GREATER.html +139 -139
  25. package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -130
  26. package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -138
  27. package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -129
  28. package/docs/classes/DBC_OR.OR.html +137 -137
  29. package/docs/classes/DBC_REGEX.REGEX.html +136 -136
  30. package/docs/classes/DBC_TYPE.TYPE.html +130 -130
  31. package/docs/classes/Demo.Demo.html +14 -14
  32. package/docs/hierarchy.html +1 -1
  33. package/docs/index.html +1 -1
  34. package/docs/modules/DBC.html +1 -1
  35. package/docs/modules/DBC_AE.html +1 -1
  36. package/docs/modules/DBC_EQ.html +1 -1
  37. package/docs/modules/DBC_GREATER.html +1 -1
  38. package/docs/modules/DBC_INSTANCE.html +1 -1
  39. package/docs/modules/DBC_JSON.OP.html +1 -1
  40. package/docs/modules/DBC_JSON.Parse.html +1 -1
  41. package/docs/modules/DBC_OR.html +1 -1
  42. package/docs/modules/DBC_REGEX.html +1 -1
  43. package/docs/modules/DBC_TYPE.html +1 -1
  44. package/docs/modules/Demo.html +1 -1
  45. package/jest.config.js +29 -18
  46. package/package.json +12 -1
  47. package/src/DBC/AE.ts +14 -9
  48. package/src/DBC/COMPARISON/GREATER.ts +2 -2
  49. package/src/DBC/COMPARISON.ts +159 -136
  50. package/src/DBC/DEFINED.ts +10 -10
  51. package/src/DBC/EQ/DIFFERENT.ts +3 -3
  52. package/src/DBC/EQ.ts +25 -9
  53. package/src/DBC/HasAttribute.ts +17 -3
  54. package/src/DBC/IF.ts +63 -19
  55. package/src/DBC/INSTANCE.ts +29 -14
  56. package/src/DBC/JSON.OP.ts +18 -3
  57. package/src/DBC/JSON.Parse.ts +21 -4
  58. package/src/DBC/OR.ts +12 -7
  59. package/src/DBC/REGEX.ts +30 -21
  60. package/src/DBC/TYPE.ts +15 -11
  61. package/src/DBC/UNDEFINED.ts +7 -10
  62. package/src/DBC/ZOD.ts +14 -9
  63. package/src/DBC.ts +165 -69
  64. package/src/Demo.ts +21 -18
  65. package/test.drawio +0 -0
  66. package/tsconfig.json +2 -5
  67. package/tsconfig.test.json +6 -11
  68. package/webpack.config.js +1 -1
package/.gitattributes ADDED
@@ -0,0 +1,8 @@
1
+ # Exclude generated site output from GitHub language statistics.
2
+ docs/** linguist-generated=true
3
+ coverage/** linguist-generated=true
4
+ dist/** linguist-generated=true
5
+
6
+ # These HTML files are examples/assessment artifacts, not source code.
7
+ Assessment.html linguist-generated=true
8
+ Test.html linguist-generated=true
@@ -0,0 +1,51 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ env:
10
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ lint:
17
+ name: Lint
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 22
24
+ cache: npm
25
+ - run: npm ci
26
+ - run: npm run ci
27
+
28
+ test:
29
+ name: Test
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-node@v4
34
+ with:
35
+ node-version: 22
36
+ cache: npm
37
+ - run: npm ci
38
+ - run: npm run test:coverage
39
+
40
+ build:
41
+ name: Build
42
+ needs: [lint, test]
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: actions/setup-node@v4
47
+ with:
48
+ node-version: 22
49
+ cache: npm
50
+ - run: npm ci
51
+ - run: npm run build
@@ -1,23 +1,23 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "label": "Build and Publish to NPM",
6
- "type": "shell",
7
- "command": "npm version patch --no-git-tag-version; npm run build; npm publish",
8
- "problemMatcher": [],
9
- "group": "build"
10
- },
11
- {
12
- "label": "Serve Test.html",
13
- "type": "shell",
14
- "command": "Copy-Item Test.html dist\\index.html; npm start",
15
- "problemMatcher": [],
16
- "isBackground": true,
17
- "presentation": {
18
- "reveal": "always",
19
- "panel": "new"
20
- }
21
- }
22
- ]
23
- }
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "Build and Publish to NPM",
6
+ "type": "shell",
7
+ "command": "npm version patch --no-git-tag-version; npm run build; npm publish",
8
+ "problemMatcher": [],
9
+ "group": "build"
10
+ },
11
+ {
12
+ "label": "Serve Test.html",
13
+ "type": "shell",
14
+ "command": "Copy-Item Test.html dist\\index.html; npm start",
15
+ "problemMatcher": [],
16
+ "isBackground": true,
17
+ "presentation": {
18
+ "reveal": "always",
19
+ "panel": "new"
20
+ }
21
+ }
22
+ ]
23
+ }
@@ -60,7 +60,7 @@ representative at an online or offline event.
60
60
 
61
61
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
62
  reported to the community leaders responsible for enforcement at
63
- Callari@WaXCode.net.
63
+ XDBC@WaXCode.net.
64
64
  All complaints will be reviewed and investigated promptly and fairly.
65
65
 
66
66
  All community leaders are obligated to respect the privacy and security of the
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  <img src="https://img.shields.io/npm/dt/xdbc?style=flat-square" alt="downloads" />
5
5
  <img src="https://img.shields.io/badge/TypeScript-5.x-blue?style=flat-square&logo=typescript" alt="TypeScript" />
6
6
  <img src="https://img.shields.io/badge/decorators-stage%203-green?style=flat-square" alt="decorators" />
7
+ <img src="https://img.shields.io/badge/optimized%20for-VS%20Code-007acc?style=flat-square&logo=visualstudiocode" alt="VS Code" />
7
8
  </p>
8
9
 
9
10
  # XDBC — e**X**plicit **D**esign **b**y **C**ontract for TypeScript
@@ -1,6 +1,6 @@
1
1
  import { AE } from "../../src/DBC/AE";
2
- import { REGEX } from "../../src/DBC/REGEX";
3
2
  import { EQ } from "../../src/DBC/EQ";
3
+ import { REGEX } from "../../src/DBC/REGEX";
4
4
 
5
5
  describe("AE", () => {
6
6
  const ae = new AE([new REGEX(/^a$/), new EQ("a")]);
@@ -1,53 +1,53 @@
1
1
  import { DEFINED } from "../../src/DBC/DEFINED";
2
2
 
3
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
- });
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
53
  });