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.
- package/.gitattributes +8 -0
- package/.github/workflows/ci.yml +51 -0
- package/.vscode/tasks.json +23 -23
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +1 -0
- package/__tests__/DBC/AE.test.ts +1 -1
- package/__tests__/DBC/DEFINED.test.ts +49 -49
- package/__tests__/DBC/Decorators.test.ts +334 -332
- package/__tests__/DBC/HasAttribute.test.ts +56 -52
- package/__tests__/DBC/IF.test.ts +57 -55
- package/__tests__/DBC/OR.test.ts +1 -1
- package/__tests__/DBC/REGEX.test.ts +4 -0
- package/__tests__/DBC/UNDEFINED.test.ts +41 -41
- package/__tests__/DBC/ZOD.test.ts +50 -50
- package/biome.json +40 -33
- package/dist/bundle.js +2297 -0
- package/docs/assets/highlight.css +22 -22
- package/docs/assets/icons.js +17 -17
- package/docs/assets/main.js +60 -60
- package/docs/assets/style.css +1640 -1640
- package/docs/classes/DBC.DBC.html +98 -98
- package/docs/classes/DBC_AE.AE.html +160 -160
- package/docs/classes/DBC_EQ.EQ.html +131 -131
- package/docs/classes/DBC_GREATER.GREATER.html +139 -139
- package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -130
- package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -138
- package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -129
- package/docs/classes/DBC_OR.OR.html +137 -137
- package/docs/classes/DBC_REGEX.REGEX.html +136 -136
- package/docs/classes/DBC_TYPE.TYPE.html +130 -130
- package/docs/classes/Demo.Demo.html +14 -14
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/modules/DBC.html +1 -1
- package/docs/modules/DBC_AE.html +1 -1
- package/docs/modules/DBC_EQ.html +1 -1
- package/docs/modules/DBC_GREATER.html +1 -1
- package/docs/modules/DBC_INSTANCE.html +1 -1
- package/docs/modules/DBC_JSON.OP.html +1 -1
- package/docs/modules/DBC_JSON.Parse.html +1 -1
- package/docs/modules/DBC_OR.html +1 -1
- package/docs/modules/DBC_REGEX.html +1 -1
- package/docs/modules/DBC_TYPE.html +1 -1
- package/docs/modules/Demo.html +1 -1
- package/jest.config.js +29 -18
- package/package.json +12 -1
- package/src/DBC/AE.ts +14 -9
- package/src/DBC/COMPARISON/GREATER.ts +2 -2
- package/src/DBC/COMPARISON.ts +159 -136
- package/src/DBC/DEFINED.ts +10 -10
- package/src/DBC/EQ/DIFFERENT.ts +3 -3
- package/src/DBC/EQ.ts +25 -9
- package/src/DBC/HasAttribute.ts +17 -3
- package/src/DBC/IF.ts +63 -19
- package/src/DBC/INSTANCE.ts +29 -14
- package/src/DBC/JSON.OP.ts +18 -3
- package/src/DBC/JSON.Parse.ts +21 -4
- package/src/DBC/OR.ts +12 -7
- package/src/DBC/REGEX.ts +30 -21
- package/src/DBC/TYPE.ts +15 -11
- package/src/DBC/UNDEFINED.ts +7 -10
- package/src/DBC/ZOD.ts +14 -9
- package/src/DBC.ts +165 -69
- package/src/Demo.ts +21 -18
- package/test.drawio +0 -0
- package/tsconfig.json +2 -5
- package/tsconfig.test.json +6 -11
- 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
|
package/.vscode/tasks.json
CHANGED
|
@@ -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
|
+
}
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -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
|
-
|
|
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
|
package/__tests__/DBC/AE.test.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { DEFINED } from "../../src/DBC/DEFINED";
|
|
2
2
|
|
|
3
3
|
describe("DEFINED", () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
});
|