@leyyo/common 1.0.8 → 1.0.9
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/dist/assertion/common-assertion.d.ts +151 -22
- package/dist/assertion/common-assertion.js +573 -90
- package/dist/assertion/common-assertion.js.map +1 -1
- package/dist/assertion/index.d.ts +1 -1
- package/dist/assertion/index.js +1 -1
- package/dist/assertion/index.types.d.ts +661 -0
- package/dist/{descriptor/index-types.js → assertion/index.types.js} +1 -1
- package/dist/assertion/index.types.js.map +1 -0
- package/dist/assets/.gitkeep +0 -0
- package/dist/config/common-config.d.ts +16 -0
- package/dist/config/common-config.js +81 -0
- package/dist/config/common-config.js.map +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.types.d.ts +13 -0
- package/dist/{assertion/index-types.js → config/index.types.js} +1 -1
- package/dist/config/index.types.js.map +1 -0
- package/dist/deploy/common-deploy.d.ts +29 -0
- package/dist/deploy/common-deploy.js +106 -0
- package/dist/deploy/common-deploy.js.map +1 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/deploy/index.js +18 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/deploy/index.types.d.ts +25 -0
- package/dist/{developer/index-types.js → deploy/index.types.js} +1 -1
- package/dist/deploy/index.types.js.map +1 -0
- package/dist/descriptor/common-descriptor.d.ts +17 -14
- package/dist/descriptor/common-descriptor.js +45 -20
- package/dist/descriptor/common-descriptor.js.map +1 -1
- package/dist/descriptor/index.d.ts +1 -1
- package/dist/descriptor/index.js +1 -1
- package/dist/descriptor/index.types.d.ts +23 -0
- package/dist/{error/index-types.js → descriptor/index.types.js} +1 -1
- package/dist/descriptor/index.types.js.map +1 -0
- package/dist/developer/common-developer.d.ts +13 -10
- package/dist/developer/common-developer.js +81 -102
- package/dist/developer/common-developer.js.map +1 -1
- package/dist/developer/index.d.ts +2 -1
- package/dist/developer/index.errors.d.ts +13 -0
- package/dist/developer/index.errors.js +24 -0
- package/dist/developer/index.errors.js.map +1 -0
- package/dist/developer/index.js +2 -1
- package/dist/developer/index.js.map +1 -1
- package/dist/developer/{index-types.d.ts → index.types.d.ts} +20 -12
- package/dist/developer/index.types.js +3 -0
- package/dist/developer/index.types.js.map +1 -0
- package/dist/error/common-error.d.ts +4 -3
- package/dist/error/common-error.js +17 -12
- package/dist/error/common-error.js.map +1 -1
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +1 -1
- package/dist/error/index.types.js +3 -0
- package/dist/error/index.types.js.map +1 -0
- package/dist/exception/exception.d.ts +3 -7
- package/dist/exception/exception.js +17 -34
- package/dist/exception/exception.js.map +1 -1
- package/dist/exception/index.d.ts +1 -1
- package/dist/exception/index.js +1 -1
- package/dist/exception/index.types.js +3 -0
- package/dist/exception/index.types.js.map +1 -0
- package/dist/exception/multiple-exception.d.ts +1 -1
- package/dist/fqn/common-fqn.d.ts +8 -8
- package/dist/fqn/common-fqn.js +23 -16
- package/dist/fqn/common-fqn.js.map +1 -1
- package/dist/fqn/index.d.ts +1 -1
- package/dist/fqn/index.js +1 -1
- package/dist/fqn/{index-types.d.ts → index.types.d.ts} +2 -2
- package/dist/fqn/index.types.js +3 -0
- package/dist/fqn/index.types.js.map +1 -0
- package/dist/hook/common-hook.d.ts +6 -13
- package/dist/hook/common-hook.js +18 -40
- package/dist/hook/common-hook.js.map +1 -1
- package/dist/hook/index.d.ts +1 -1
- package/dist/hook/index.js +1 -1
- package/dist/hook/{index-types.d.ts → index.types.d.ts} +6 -5
- package/dist/hook/index.types.js +3 -0
- package/dist/hook/index.types.js.map +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -3
- package/dist/internal.js +2 -4
- package/dist/internal.js.map +1 -1
- package/dist/is/common-is.d.ts +18 -4
- package/dist/is/common-is.js +53 -12
- package/dist/is/common-is.js.map +1 -1
- package/dist/is/index.d.ts +1 -1
- package/dist/is/index.js +1 -1
- package/dist/is/{index-types.d.ts → index.types.d.ts} +56 -5
- package/dist/is/index.types.js +3 -0
- package/dist/is/index.types.js.map +1 -0
- package/dist/leyyo/index.d.ts +1 -1
- package/dist/leyyo/index.js +1 -1
- package/dist/leyyo/{index-types.d.ts → index.types.d.ts} +13 -3
- package/dist/leyyo/index.types.js +3 -0
- package/dist/leyyo/index.types.js.map +1 -0
- package/dist/leyyo/leyyo-common-hook.js +7 -7
- package/dist/leyyo/leyyo-common-hook.js.map +1 -1
- package/dist/leyyo/leyyo.d.ts +14 -4
- package/dist/leyyo/leyyo.js +34 -19
- package/dist/leyyo/leyyo.js.map +1 -1
- package/dist/log/common-log.d.ts +6 -5
- package/dist/log/common-log.js +90 -22
- package/dist/log/common-log.js.map +1 -1
- package/dist/log/index.d.ts +1 -1
- package/dist/log/index.js +1 -1
- package/dist/log/{index-types.d.ts → index.types.d.ts} +18 -23
- package/dist/log/index.types.js +3 -0
- package/dist/log/index.types.js.map +1 -0
- package/dist/log/logger-instance.d.ts +11 -16
- package/dist/log/logger-instance.js +86 -50
- package/dist/log/logger-instance.js.map +1 -1
- package/dist/log/severity.d.ts +1 -1
- package/dist/log/severity.js +1 -1
- package/dist/log/severity.js.map +1 -1
- package/dist/mixin/common-mixin.d.ts +23 -0
- package/dist/mixin/common-mixin.js +165 -0
- package/dist/mixin/common-mixin.js.map +1 -0
- package/dist/mixin/index.d.ts +1 -0
- package/dist/mixin/index.js +18 -0
- package/dist/mixin/index.js.map +1 -0
- package/dist/mixin/index.types.d.ts +19 -0
- package/dist/mixin/index.types.js +3 -0
- package/dist/mixin/index.types.js.map +1 -0
- package/dist/name/common-name.d.ts +16 -0
- package/dist/name/common-name.js +82 -0
- package/dist/name/common-name.js.map +1 -0
- package/dist/name/index.d.ts +1 -0
- package/dist/name/index.js +18 -0
- package/dist/name/index.js.map +1 -0
- package/dist/name/index.types.d.ts +21 -0
- package/dist/name/index.types.js +3 -0
- package/dist/name/index.types.js.map +1 -0
- package/dist/repo/common-repo.d.ts +14 -11
- package/dist/repo/common-repo.js +64 -78
- package/dist/repo/common-repo.js.map +1 -1
- package/dist/repo/index.d.ts +1 -2
- package/dist/repo/index.js +1 -2
- package/dist/repo/index.js.map +1 -1
- package/dist/repo/{index-types.d.ts → index.types.d.ts} +27 -9
- package/dist/repo/index.types.js +3 -0
- package/dist/repo/index.types.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/{index-types.d.ts → index.types.d.ts} +21 -9
- package/dist/shared/{index-types.js → index.types.js} +1 -1
- package/dist/shared/index.types.js.map +1 -0
- package/dist/system/common-system.d.ts +4 -3
- package/dist/system/common-system.js +10 -11
- package/dist/system/common-system.js.map +1 -1
- package/dist/system/index.d.ts +1 -3
- package/dist/system/index.js +1 -3
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.types.js +3 -0
- package/dist/system/index.types.js.map +1 -0
- package/dist/test/common-test.d.ts +14 -0
- package/dist/test/common-test.js +48 -0
- package/dist/test/common-test.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.js +19 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/index.types.d.ts +9 -0
- package/dist/test/index.types.js +3 -0
- package/dist/test/index.types.js.map +1 -0
- package/dist/test/tested.d.ts +1 -0
- package/dist/test/tested.js +9 -0
- package/dist/test/tested.js.map +1 -0
- package/dist/to/common-to.d.ts +55 -27
- package/dist/to/common-to.js +554 -381
- package/dist/to/common-to.js.map +1 -1
- package/dist/to/index.d.ts +1 -1
- package/dist/to/index.js +1 -1
- package/dist/to/index.types.d.ts +72 -0
- package/dist/to/index.types.js +3 -0
- package/dist/to/index.types.js.map +1 -0
- package/dist/to/list.d.ts +10 -0
- package/dist/to/list.js +18 -0
- package/dist/to/list.js.map +1 -1
- package/dist/wrapper/common-wrapper.d.ts +9 -9
- package/dist/wrapper/common-wrapper.js +11 -10
- package/dist/wrapper/common-wrapper.js.map +1 -1
- package/dist/wrapper/index.d.ts +1 -1
- package/dist/wrapper/index.js +1 -1
- package/dist/wrapper/{index-types.d.ts → index.types.d.ts} +6 -6
- package/dist/wrapper/index.types.js +3 -0
- package/dist/wrapper/index.types.js.map +1 -0
- package/dist/wrapper/wrap.d.ts +3 -3
- package/package.json +5 -2
- package/dist/assertion/index-types.d.ts +0 -465
- package/dist/assertion/index-types.js.map +0 -1
- package/dist/descriptor/index-types.d.ts +0 -21
- package/dist/descriptor/index-types.js.map +0 -1
- package/dist/developer/index-types.js.map +0 -1
- package/dist/error/index-types.js.map +0 -1
- package/dist/exception/index-types.js +0 -3
- package/dist/exception/index-types.js.map +0 -1
- package/dist/fqn/index-types.js +0 -3
- package/dist/fqn/index-types.js.map +0 -1
- package/dist/hook/index-types.js +0 -3
- package/dist/hook/index-types.js.map +0 -1
- package/dist/is/index-types.js +0 -3
- package/dist/is/index-types.js.map +0 -1
- package/dist/leyyo/index-types.js +0 -3
- package/dist/leyyo/index-types.js.map +0 -1
- package/dist/log/index-types.js +0 -3
- package/dist/log/index-types.js.map +0 -1
- package/dist/repo/index-types.js +0 -3
- package/dist/repo/index-types.js.map +0 -1
- package/dist/repo/repo-type.d.ts +0 -8
- package/dist/repo/repo-type.js +0 -8
- package/dist/repo/repo-type.js.map +0 -1
- package/dist/shared/index-types.js.map +0 -1
- package/dist/system/http-method.d.ts +0 -8
- package/dist/system/http-method.js +0 -8
- package/dist/system/http-method.js.map +0 -1
- package/dist/system/http-place.d.ts +0 -8
- package/dist/system/http-place.js +0 -8
- package/dist/system/http-place.js.map +0 -1
- package/dist/system/index-types.js +0 -3
- package/dist/system/index-types.js.map +0 -1
- package/dist/to/index-types.d.ts +0 -40
- package/dist/to/index-types.js +0 -3
- package/dist/to/index-types.js.map +0 -1
- package/dist/wrapper/index-types.js +0 -3
- package/dist/wrapper/index-types.js.map +0 -1
- /package/dist/error/{index-types.d.ts → index.types.d.ts} +0 -0
- /package/dist/exception/{index-types.d.ts → index.types.d.ts} +0 -0
- /package/dist/system/{index-types.d.ts → index.types.d.ts} +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommonAssertion = void 0;
|
|
4
4
|
const internal_1 = require("../internal");
|
|
5
|
-
const to_1 = require("../to");
|
|
6
5
|
// noinspection JSUnusedGlobalSymbols
|
|
7
6
|
/** @inheritDoc */
|
|
8
7
|
class CommonAssertion {
|
|
9
8
|
// endregion properties
|
|
10
|
-
constructor() {
|
|
9
|
+
constructor(lyy) {
|
|
10
|
+
this.lyy = lyy;
|
|
11
|
+
// region properties
|
|
11
12
|
this._EMPTY = [null, undefined];
|
|
12
13
|
}
|
|
13
14
|
// region internal
|
|
@@ -17,158 +18,640 @@ class CommonAssertion {
|
|
|
17
18
|
}
|
|
18
19
|
else if (typeof opt === 'function') {
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
const values = opt();
|
|
22
|
+
if (Array.isArray(values)) {
|
|
23
|
+
let [pck, testCase, opt2] = values;
|
|
24
|
+
if (!opt2) {
|
|
25
|
+
opt2 = {};
|
|
26
|
+
}
|
|
27
|
+
opt2['message'] = this.lyy.test.code(pck, testCase);
|
|
28
|
+
return opt2;
|
|
29
|
+
}
|
|
30
|
+
else if (typeof values === 'string') {
|
|
31
|
+
return { issue: values };
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return (values && values.contructor === Object) ? values : {};
|
|
35
|
+
}
|
|
21
36
|
}
|
|
22
37
|
catch (e) {
|
|
23
|
-
const
|
|
38
|
+
const now = Date.now();
|
|
24
39
|
return {
|
|
25
|
-
|
|
40
|
+
message: e.message,
|
|
41
|
+
[`e-${now}-name`]: e.name,
|
|
26
42
|
};
|
|
27
43
|
}
|
|
28
44
|
}
|
|
29
45
|
else {
|
|
30
|
-
return opt;
|
|
46
|
+
return ((opt === null || opt === void 0 ? void 0 : opt.contructor) === Object) ? opt : {};
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
_optional(value, fn) {
|
|
50
|
+
if (this._EMPTY.includes(value)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
fn();
|
|
54
|
+
}
|
|
55
|
+
_array(value, opt, issue, fn) {
|
|
37
56
|
if (!Array.isArray(value)) {
|
|
38
|
-
this.dev.
|
|
57
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue, reason: 'type', type: typeof value });
|
|
58
|
+
}
|
|
59
|
+
const arr = value;
|
|
60
|
+
if (arr.length < 1) {
|
|
61
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue, reason: 'size', size: 0 });
|
|
62
|
+
}
|
|
63
|
+
const wrongIndexes = arr.filter(item => !fn(item)).map((_v, index) => index);
|
|
64
|
+
if (wrongIndexes.length > 0) {
|
|
65
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue, reason: 'items', wrongIndexes });
|
|
39
66
|
}
|
|
40
67
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.boolean', value, type: typeof value });
|
|
68
|
+
_is(value, opt, issue, fn, extra) {
|
|
69
|
+
if (!fn(value)) {
|
|
70
|
+
throw this.lyy.dev.invalidError(this._run(opt), Object.assign({ issue, value, type: typeof value }, extra));
|
|
45
71
|
}
|
|
46
72
|
}
|
|
73
|
+
_replaceMethod(method) {
|
|
74
|
+
if (method.endsWith('?')) {
|
|
75
|
+
method = method.slice(0, -1) + 'Optional';
|
|
76
|
+
}
|
|
77
|
+
else if (method.endsWith('[]')) {
|
|
78
|
+
method = method.slice(0, -2) + 'Array';
|
|
79
|
+
}
|
|
80
|
+
return method;
|
|
81
|
+
}
|
|
82
|
+
_execLambda(value, method, opt, isDual, throwable, another) {
|
|
83
|
+
if (typeof method !== 'string') {
|
|
84
|
+
if (throwable) {
|
|
85
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue: 'invalid.method.name', value: method });
|
|
86
|
+
}
|
|
87
|
+
return 'invalid.method.name';
|
|
88
|
+
}
|
|
89
|
+
method = this._replaceMethod(method);
|
|
90
|
+
const fn = this[method];
|
|
91
|
+
if (typeof fn !== 'function') {
|
|
92
|
+
if (throwable) {
|
|
93
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue: 'unknown.assertion.method', value: method });
|
|
94
|
+
}
|
|
95
|
+
return 'unknown.assertion.method';
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
if (isDual) {
|
|
99
|
+
fn(value, another, opt);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
fn(value, opt);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (throwable) {
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
return e.message;
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
_isTupleReason(value, setting) {
|
|
114
|
+
if (!Array.isArray(setting)) {
|
|
115
|
+
return 'invalid.tuple.setting';
|
|
116
|
+
}
|
|
117
|
+
if (!Array.isArray(value)) {
|
|
118
|
+
return 'tuple.should.be.array';
|
|
119
|
+
}
|
|
120
|
+
const arr = value;
|
|
121
|
+
if (arr.length < 1) {
|
|
122
|
+
return 'tuple.empty.array';
|
|
123
|
+
}
|
|
124
|
+
if (arr.length !== setting.length) {
|
|
125
|
+
return 'tuple.size.conflict';
|
|
126
|
+
}
|
|
127
|
+
let index = -1;
|
|
128
|
+
for (const set of setting) {
|
|
129
|
+
index++;
|
|
130
|
+
let method;
|
|
131
|
+
let another;
|
|
132
|
+
let isDual;
|
|
133
|
+
if (Array.isArray(set)) {
|
|
134
|
+
if (set[0] === 'or') {
|
|
135
|
+
const orCase = set;
|
|
136
|
+
if (!this._isOrCase(arr[index], orCase[1])) {
|
|
137
|
+
return 'invalid-or-case';
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
const dualCase = set;
|
|
142
|
+
method = dualCase[0];
|
|
143
|
+
another = dualCase[1];
|
|
144
|
+
isDual = true;
|
|
145
|
+
if (another === undefined) {
|
|
146
|
+
return 'invalid.tuple.setting';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else if (typeof set === 'string') {
|
|
150
|
+
method = set;
|
|
151
|
+
}
|
|
152
|
+
const issue = this._execLambda(arr[index], method, {}, isDual, false, another);
|
|
153
|
+
if (issue) {
|
|
154
|
+
return issue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
_isTuple(value, setting) {
|
|
160
|
+
return !this._isTupleReason(value, setting);
|
|
161
|
+
}
|
|
162
|
+
_isOrCase(value, types) {
|
|
163
|
+
for (const type of types) {
|
|
164
|
+
let method;
|
|
165
|
+
let another;
|
|
166
|
+
let isDual;
|
|
167
|
+
if (typeof type === 'string') {
|
|
168
|
+
method = type;
|
|
169
|
+
}
|
|
170
|
+
else if (Array.isArray(type) && type.length === 2) {
|
|
171
|
+
method = type[0];
|
|
172
|
+
another = type[1];
|
|
173
|
+
isDual = true;
|
|
174
|
+
}
|
|
175
|
+
const issue = this._execLambda(value, method, {}, isDual, false, another);
|
|
176
|
+
if (!issue) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
// endregion internal
|
|
183
|
+
// region general
|
|
47
184
|
/** @inheritDoc */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
185
|
+
notEmpty(value, opt) {
|
|
186
|
+
if (this._EMPTY.includes(value)) {
|
|
187
|
+
throw this.lyy.dev.invalidError(this._run(opt), { issue: 'empty', value, type: typeof value });
|
|
188
|
+
}
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
// endregion general
|
|
192
|
+
// region or
|
|
193
|
+
orCase(value, types, opt) {
|
|
194
|
+
let firstError;
|
|
195
|
+
for (const type of types) {
|
|
196
|
+
let method;
|
|
197
|
+
let another;
|
|
198
|
+
let isDual;
|
|
199
|
+
let errorOccurred;
|
|
200
|
+
if (Array.isArray(type)) {
|
|
201
|
+
const dualCase = type;
|
|
202
|
+
method = dualCase[0];
|
|
203
|
+
another = dualCase[1];
|
|
204
|
+
isDual = true;
|
|
205
|
+
if (another === undefined) {
|
|
206
|
+
if (!firstError) {
|
|
207
|
+
firstError = this.lyy.dev.invalidError(this._run(opt), { issue: 'invalid.tuple.setting', value: method });
|
|
208
|
+
}
|
|
209
|
+
errorOccurred = true;
|
|
55
210
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
211
|
+
}
|
|
212
|
+
else if (typeof type === 'string') {
|
|
213
|
+
method = type;
|
|
214
|
+
}
|
|
215
|
+
if (!errorOccurred) {
|
|
216
|
+
const issue = this._execLambda(value, method, opt, isDual, false, another);
|
|
217
|
+
if (!issue) {
|
|
59
218
|
return;
|
|
60
219
|
}
|
|
61
|
-
|
|
220
|
+
if (!firstError) {
|
|
221
|
+
firstError = this.lyy.dev.invalidError(this._run(opt), { issue, value: method });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (firstError) {
|
|
226
|
+
throw firstError;
|
|
62
227
|
}
|
|
63
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.class', value, type: typeof value });
|
|
64
228
|
}
|
|
65
229
|
/** @inheritDoc */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.date', value, type: typeof value });
|
|
69
|
-
}
|
|
230
|
+
orCaseOptional(value, types, opt) {
|
|
231
|
+
this._optional(value, () => this.orCase(value, types, opt));
|
|
70
232
|
}
|
|
71
233
|
/** @inheritDoc */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.function', value, type: typeof value });
|
|
75
|
-
}
|
|
234
|
+
orCaseArray(value, types, opt) {
|
|
235
|
+
this._array(value, opt, 'invalid.orCase.array', (v) => this._isOrCase(v, types));
|
|
76
236
|
}
|
|
237
|
+
// endregion or
|
|
238
|
+
// region realValue
|
|
77
239
|
/** @inheritDoc */
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.symbol', value, type: typeof value });
|
|
81
|
-
}
|
|
240
|
+
realValue(value, opt) {
|
|
241
|
+
this._is(value, opt, 'invalid.realValue', v => this.lyy.is.realValue(v), {});
|
|
82
242
|
}
|
|
83
243
|
/** @inheritDoc */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
244
|
+
realValueOptional(value, opt) {
|
|
245
|
+
this._optional(value, () => this.realValue(value, opt));
|
|
246
|
+
}
|
|
247
|
+
/** @inheritDoc */
|
|
248
|
+
realValueArray(value, opt) {
|
|
249
|
+
this._array(value, opt, 'invalid.realValue.array', (v) => this.lyy.is.realValue(v));
|
|
250
|
+
}
|
|
251
|
+
// endregion realValue
|
|
252
|
+
// region object
|
|
253
|
+
/** @inheritDoc */
|
|
254
|
+
object(value, opt) {
|
|
255
|
+
this._is(value, opt, 'invalid.object', v => this.lyy.is.object(v), {});
|
|
256
|
+
}
|
|
257
|
+
/** @inheritDoc */
|
|
258
|
+
objectOptional(value, opt) {
|
|
259
|
+
this._optional(value, () => this.object(value, opt));
|
|
260
|
+
}
|
|
261
|
+
objectArray(value, opt) {
|
|
262
|
+
this._array(value, opt, 'invalid.object.array', (v) => this.lyy.is.object(v));
|
|
263
|
+
}
|
|
264
|
+
// endregion object
|
|
265
|
+
// region bareObject
|
|
266
|
+
/** @inheritDoc */
|
|
267
|
+
bareObject(value, opt) {
|
|
268
|
+
this._is(value, opt, 'invalid.bareObject', v => this.lyy.is.bareObject(v), {});
|
|
269
|
+
}
|
|
270
|
+
/** @inheritDoc */
|
|
271
|
+
bareObjectOptional(value, opt) {
|
|
272
|
+
this._optional(value, () => this.bareObject(value, opt));
|
|
273
|
+
}
|
|
274
|
+
bareObjectArray(value, opt) {
|
|
275
|
+
this._array(value, opt, 'invalid.bareObject.array', (v) => this.lyy.is.bareObject(v));
|
|
276
|
+
}
|
|
277
|
+
// endregion bareObject
|
|
278
|
+
// region anotherObject
|
|
279
|
+
/** @inheritDoc */
|
|
280
|
+
anotherObject(value, opt) {
|
|
281
|
+
this._is(value, opt, 'invalid.anotherObject', v => this.lyy.is.anotherObject(v), {});
|
|
282
|
+
}
|
|
283
|
+
/** @inheritDoc */
|
|
284
|
+
anotherObjectOptional(value, opt) {
|
|
285
|
+
this._optional(value, () => this.anotherObject(value, opt));
|
|
286
|
+
}
|
|
287
|
+
/** @inheritDoc */
|
|
288
|
+
anotherObjectArray(value, opt) {
|
|
289
|
+
this._array(value, opt, 'invalid.anotherObject.array', (v) => this.lyy.is.anotherObject(v));
|
|
290
|
+
}
|
|
291
|
+
// endregion anotherObject
|
|
292
|
+
// region array
|
|
293
|
+
/** @inheritDoc */
|
|
294
|
+
array(value, opt) {
|
|
295
|
+
this._is(value, opt, 'invalid.array', v => Array.isArray(v) && v.length > 0, {});
|
|
296
|
+
}
|
|
297
|
+
/** @inheritDoc */
|
|
298
|
+
arrayOptional(value, opt) {
|
|
299
|
+
this._optional(value, () => this.array(value, opt));
|
|
300
|
+
}
|
|
301
|
+
/** @inheritDoc */
|
|
302
|
+
arrayArray(value, opt) {
|
|
303
|
+
this._array(value, opt, 'invalid.array.array', (v) => Array.isArray(v));
|
|
304
|
+
}
|
|
305
|
+
// endregion array
|
|
306
|
+
// region instanceOf
|
|
307
|
+
/** @inheritDoc */
|
|
308
|
+
instanceOf(value, clazz, opt) {
|
|
309
|
+
this._is(value, opt, 'invalid.instanceOf', v => this.lyy.is.instanceOf(v, clazz), { clazz });
|
|
310
|
+
}
|
|
311
|
+
/** @inheritDoc */
|
|
312
|
+
instanceOfOptional(value, clazz, opt) {
|
|
313
|
+
this._optional(value, () => this.instanceOf(value, clazz, opt));
|
|
314
|
+
}
|
|
315
|
+
/** @inheritDoc */
|
|
316
|
+
instanceOfArray(value, clazz, opt) {
|
|
317
|
+
this._array(value, opt, 'invalid.instanceOf.array', (v) => this.lyy.is.instanceOf(v, clazz));
|
|
318
|
+
}
|
|
319
|
+
// endregion instanceOf
|
|
320
|
+
// region tuple
|
|
321
|
+
/** @inheritDoc */
|
|
322
|
+
tuple(value, setting, opt) {
|
|
323
|
+
if (!Array.isArray(setting)) {
|
|
324
|
+
throw this.lyy.dev.invalidError(this._run(opt), {
|
|
325
|
+
issue: 'invalid.tuple.setting',
|
|
326
|
+
value: setting,
|
|
327
|
+
type: typeof setting
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (!Array.isArray(value)) {
|
|
331
|
+
throw this.lyy.dev.invalidError(this._run(opt), {
|
|
332
|
+
issue: 'tuple.should.be.array',
|
|
333
|
+
value: setting,
|
|
334
|
+
type: typeof setting
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
const arr = value;
|
|
338
|
+
if (arr.length !== setting.length) {
|
|
339
|
+
throw this.lyy.dev.invalidError(this._run(opt), {
|
|
340
|
+
issue: 'tuple.size.conflict',
|
|
341
|
+
value: arr.length,
|
|
342
|
+
setting: setting.length
|
|
343
|
+
});
|
|
87
344
|
}
|
|
345
|
+
setting.forEach((set, index) => {
|
|
346
|
+
let method;
|
|
347
|
+
let another;
|
|
348
|
+
let isDual;
|
|
349
|
+
if (Array.isArray(set)) {
|
|
350
|
+
if (set[0] === 'or') {
|
|
351
|
+
const orCase = set;
|
|
352
|
+
this.orCase(arr[index], orCase[1], opt);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const dualCase = set;
|
|
356
|
+
method = dualCase[0];
|
|
357
|
+
another = dualCase[1];
|
|
358
|
+
isDual = true;
|
|
359
|
+
if (another === undefined) {
|
|
360
|
+
throw this.lyy.dev.invalidError(this._run(opt), {
|
|
361
|
+
issue: 'invalid.tuple.setting',
|
|
362
|
+
index,
|
|
363
|
+
value: setting,
|
|
364
|
+
type: typeof setting
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else if (typeof set === 'string') {
|
|
369
|
+
method = set;
|
|
370
|
+
}
|
|
371
|
+
this._execLambda(arr[index], method, opt, isDual, true, another);
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/** @inheritDoc */
|
|
375
|
+
tupleOptional(value, setting, opt) {
|
|
376
|
+
this._optional(value, () => this.tuple(value, setting, opt));
|
|
377
|
+
}
|
|
378
|
+
/** @inheritDoc */
|
|
379
|
+
tupleArray(value, setting, opt) {
|
|
380
|
+
this._array(value, opt, 'invalid.tuple.array', (v) => this._isTuple(v, setting));
|
|
381
|
+
}
|
|
382
|
+
// endregion tuple
|
|
383
|
+
// region primitive
|
|
384
|
+
/** @inheritDoc */
|
|
385
|
+
primitive(value, opt) {
|
|
386
|
+
this._is(value, opt, 'invalid.primitive', v => this.lyy.is.primitive(v), {});
|
|
387
|
+
}
|
|
388
|
+
/** @inheritDoc */
|
|
389
|
+
primitiveOptional(value, opt) {
|
|
390
|
+
this._optional(value, () => this.primitive(value, opt));
|
|
391
|
+
}
|
|
392
|
+
/** @inheritDoc */
|
|
393
|
+
primitiveArray(value, opt) {
|
|
394
|
+
this._array(value, opt, 'invalid.primitive.array', (v) => this.lyy.is.primitive(v));
|
|
88
395
|
}
|
|
396
|
+
// endregion primitive
|
|
397
|
+
// region key
|
|
89
398
|
/** @inheritDoc */
|
|
90
399
|
key(value, opt) {
|
|
91
|
-
|
|
92
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.key', value, type: typeof value });
|
|
93
|
-
}
|
|
400
|
+
this._is(value, opt, 'invalid.key', v => this.lyy.is.key(v), {});
|
|
94
401
|
}
|
|
95
402
|
/** @inheritDoc */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
403
|
+
keyOptional(value, opt) {
|
|
404
|
+
this._optional(value, () => this.key(value, opt));
|
|
405
|
+
}
|
|
406
|
+
/** @inheritDoc */
|
|
407
|
+
keyArray(value, opt) {
|
|
408
|
+
this._array(value, opt, 'invalid.key.array', (v) => this.lyy.is.key(v));
|
|
409
|
+
}
|
|
410
|
+
// endregion key
|
|
411
|
+
// region arrayLike
|
|
412
|
+
/** @inheritDoc */
|
|
413
|
+
arrayLike(value, opt) {
|
|
414
|
+
this._is(value, opt, 'invalid.arrayLike', v => this.lyy.is.arrayLike(v), {});
|
|
415
|
+
}
|
|
416
|
+
/** @inheritDoc */
|
|
417
|
+
arrayLikeOptional(value, opt) {
|
|
418
|
+
this._optional(value, () => this.arrayLike(value, opt));
|
|
419
|
+
}
|
|
420
|
+
/** @inheritDoc */
|
|
421
|
+
arrayLikeArray(value, opt) {
|
|
422
|
+
this._array(value, opt, 'invalid.arrayLike.array', (v) => this.lyy.is.arrayLike(v));
|
|
423
|
+
}
|
|
424
|
+
// endregion arrayLike
|
|
425
|
+
// region function
|
|
426
|
+
/** @inheritDoc */
|
|
427
|
+
func(value, opt) {
|
|
428
|
+
this._is(value, opt, 'invalid.function', v => this.lyy.is.func(v), {});
|
|
429
|
+
}
|
|
430
|
+
/** @inheritDoc */
|
|
431
|
+
funcOptional(value, opt) {
|
|
432
|
+
this._optional(value, () => this.func(value, opt));
|
|
433
|
+
}
|
|
434
|
+
/** @inheritDoc */
|
|
435
|
+
funcArray(value, opt) {
|
|
436
|
+
this._array(value, opt, 'invalid.function.array', (v) => this.lyy.is.func(v));
|
|
437
|
+
}
|
|
438
|
+
// endregion function
|
|
439
|
+
// region symbol
|
|
440
|
+
/** @inheritDoc */
|
|
441
|
+
sym(value, opt) {
|
|
442
|
+
this._is(value, opt, 'invalid.symbol', v => this.lyy.is.sym(v), {});
|
|
443
|
+
}
|
|
444
|
+
/** @inheritDoc */
|
|
445
|
+
symOptional(value, opt) {
|
|
446
|
+
this._optional(value, () => this.sym(value, opt));
|
|
100
447
|
}
|
|
101
448
|
/** @inheritDoc */
|
|
449
|
+
symArray(value, opt) {
|
|
450
|
+
this._array(value, opt, 'invalid.symbol.array', (v) => this.lyy.is.sym(v));
|
|
451
|
+
}
|
|
452
|
+
// endregion symbol
|
|
453
|
+
// region number
|
|
454
|
+
/** @inheritDoc */
|
|
102
455
|
number(value, opt) {
|
|
103
|
-
|
|
104
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.number', value, type: typeof value });
|
|
105
|
-
}
|
|
456
|
+
this._is(value, opt, 'invalid.number', v => this.lyy.is.number(v), {});
|
|
106
457
|
}
|
|
107
458
|
/** @inheritDoc */
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.object', value, type: typeof value });
|
|
111
|
-
}
|
|
459
|
+
numberOptional(value, opt) {
|
|
460
|
+
this._optional(value, () => this.number(value, opt));
|
|
112
461
|
}
|
|
113
462
|
/** @inheritDoc */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.bare.object', value, type: typeof value });
|
|
117
|
-
}
|
|
463
|
+
numberArray(value, opt) {
|
|
464
|
+
this._array(value, opt, 'invalid.number.array', (v) => this.lyy.is.number(v));
|
|
118
465
|
}
|
|
466
|
+
// endregion number
|
|
467
|
+
// region positiveNumber
|
|
119
468
|
/** @inheritDoc */
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
469
|
+
positiveNumber(value, opt) {
|
|
470
|
+
this._is(value, opt, 'invalid.positiveNumber', v => this.lyy.is.positiveNumber(v), {});
|
|
471
|
+
}
|
|
472
|
+
/** @inheritDoc */
|
|
473
|
+
positiveNumberOptional(value, opt) {
|
|
474
|
+
this._optional(value, () => this.positiveNumber(value, opt));
|
|
475
|
+
}
|
|
476
|
+
/** @inheritDoc */
|
|
477
|
+
positiveNumberArray(value, opt) {
|
|
478
|
+
this._array(value, opt, 'invalid.positiveNumber.array', (v) => this.lyy.is.positiveNumber(v));
|
|
124
479
|
}
|
|
480
|
+
// endregion positiveNumber
|
|
481
|
+
// region nonNegativeNumber
|
|
482
|
+
/** @inheritDoc */
|
|
483
|
+
nonNegativeNumber(value, opt) {
|
|
484
|
+
this._is(value, opt, 'invalid.nonNegativeNumber', v => this.lyy.is.nonNegativeNumber(v), {});
|
|
485
|
+
}
|
|
486
|
+
/** @inheritDoc */
|
|
487
|
+
nonNegativeNumberOptional(value, opt) {
|
|
488
|
+
this._optional(value, () => this.nonNegativeNumber(value, opt));
|
|
489
|
+
}
|
|
490
|
+
/** @inheritDoc */
|
|
491
|
+
nonNegativeNumberArray(value, opt) {
|
|
492
|
+
this._array(value, opt, 'invalid.nonNegativeNumber.array', (v) => this.lyy.is.nonNegativeNumber(v));
|
|
493
|
+
}
|
|
494
|
+
// endregion nonNegativeNumber
|
|
495
|
+
// region integer
|
|
496
|
+
/** @inheritDoc */
|
|
497
|
+
integer(value, opt) {
|
|
498
|
+
this._is(value, opt, 'invalid.integer', v => this.lyy.is.integer(v), {});
|
|
499
|
+
}
|
|
500
|
+
/** @inheritDoc */
|
|
501
|
+
integerOptional(value, opt) {
|
|
502
|
+
this._optional(value, () => this.integer(value, opt));
|
|
503
|
+
}
|
|
504
|
+
/** @inheritDoc */
|
|
505
|
+
integerArray(value, opt) {
|
|
506
|
+
this._array(value, opt, 'invalid.integer.array', (v) => this.lyy.is.integer(v));
|
|
507
|
+
}
|
|
508
|
+
// endregion integer
|
|
509
|
+
// region safeInteger
|
|
125
510
|
/** @inheritDoc */
|
|
126
511
|
safeInteger(value, opt) {
|
|
127
|
-
|
|
128
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.safe.integer', value, type: typeof value });
|
|
129
|
-
}
|
|
512
|
+
this._is(value, opt, 'invalid.safeInteger', v => this.lyy.is.safeInteger(v), {});
|
|
130
513
|
}
|
|
131
514
|
/** @inheritDoc */
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.positive', value, type: typeof value });
|
|
135
|
-
}
|
|
515
|
+
safeIntegerOptional(value, opt) {
|
|
516
|
+
this._optional(value, () => this.safeInteger(value, opt));
|
|
136
517
|
}
|
|
137
518
|
/** @inheritDoc */
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
519
|
+
safeIntegerArray(value, opt) {
|
|
520
|
+
this._array(value, opt, 'invalid.safeInteger.array', (v) => this.lyy.is.safeInteger(v));
|
|
521
|
+
}
|
|
522
|
+
// endregion safeInteger
|
|
523
|
+
// region positiveInteger
|
|
524
|
+
/** @inheritDoc */
|
|
525
|
+
positiveInteger(value, opt) {
|
|
526
|
+
this._is(value, opt, 'invalid.positiveInteger', v => this.lyy.is.positiveInteger(v), {});
|
|
527
|
+
}
|
|
528
|
+
/** @inheritDoc */
|
|
529
|
+
positiveIntegerOptional(value, opt) {
|
|
530
|
+
this._optional(value, () => this.positiveInteger(value, opt));
|
|
531
|
+
}
|
|
532
|
+
/** @inheritDoc */
|
|
533
|
+
positiveIntegerArray(value, opt) {
|
|
534
|
+
this._array(value, opt, 'invalid.positiveInteger.array', (v) => this.lyy.is.positiveInteger(v));
|
|
535
|
+
}
|
|
536
|
+
// endregion positiveInteger
|
|
537
|
+
// region nonNegativeInteger
|
|
538
|
+
nonNegativeInteger(value, opt) {
|
|
539
|
+
this._is(value, opt, 'invalid.nonNegativeInteger', v => this.lyy.is.nonNegativeInteger(v), {});
|
|
540
|
+
}
|
|
541
|
+
nonNegativeIntegerArray(value, opt) {
|
|
542
|
+
this._optional(value, () => this.nonNegativeInteger(value, opt));
|
|
543
|
+
}
|
|
544
|
+
nonNegativeIntegerOptional(value, opt) {
|
|
545
|
+
this._array(value, opt, 'invalid.nonNegativeInteger.array', (v) => this.lyy.is.nonNegativeInteger(v));
|
|
142
546
|
}
|
|
547
|
+
// endregion nonNegativeInteger
|
|
548
|
+
// region string
|
|
143
549
|
/** @inheritDoc */
|
|
144
550
|
string(value, opt) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
551
|
+
this._is(value, opt, 'invalid.string', v => this.lyy.is.string(v), {});
|
|
552
|
+
}
|
|
553
|
+
/** @inheritDoc */
|
|
554
|
+
stringOptional(value, opt) {
|
|
555
|
+
this._optional(value, () => this.string(value, opt));
|
|
148
556
|
}
|
|
149
557
|
/** @inheritDoc */
|
|
558
|
+
stringArray(value, opt) {
|
|
559
|
+
this._array(value, opt, 'invalid.string.array', (v) => this.lyy.is.string(v));
|
|
560
|
+
}
|
|
561
|
+
// endregion string
|
|
562
|
+
// region text
|
|
563
|
+
/** @inheritDoc */
|
|
150
564
|
text(value, opt) {
|
|
151
|
-
|
|
152
|
-
this.dev.invalid(this._run(opt), { issue: 'invalid.text', value, type: typeof value });
|
|
153
|
-
}
|
|
565
|
+
this._is(value, opt, 'invalid.text', v => this.lyy.is.text(v), {});
|
|
154
566
|
}
|
|
155
567
|
/** @inheritDoc */
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
568
|
+
textOptional(value, opt) {
|
|
569
|
+
this._optional(value, () => this.text(value, opt));
|
|
570
|
+
}
|
|
571
|
+
/** @inheritDoc */
|
|
572
|
+
textArray(value, opt) {
|
|
573
|
+
this._array(value, opt, 'invalid.text.array', (v) => this.lyy.is.text(v));
|
|
574
|
+
}
|
|
575
|
+
// endregion text
|
|
576
|
+
// region clazz
|
|
577
|
+
/** @inheritDoc */
|
|
578
|
+
clazz(value, opt) {
|
|
579
|
+
this._is(value, opt, 'invalid.class', v => this.lyy.is.clazz(v), {});
|
|
580
|
+
}
|
|
581
|
+
/** @inheritDoc */
|
|
582
|
+
clazzOptional(value, opt) {
|
|
583
|
+
this._optional(value, () => this.clazz(value, opt));
|
|
584
|
+
}
|
|
585
|
+
/** @inheritDoc */
|
|
586
|
+
clazzArray(value, opt) {
|
|
587
|
+
this._array(value, opt, 'invalid.clazz.array', (v) => this.lyy.is.clazz(v));
|
|
588
|
+
}
|
|
589
|
+
// endregion clazz
|
|
590
|
+
// region possibleFunc
|
|
591
|
+
/** @inheritDoc */
|
|
592
|
+
possibleFunc(value, opt) {
|
|
593
|
+
this._is(value, opt, 'invalid.possibleFunc', v => this.lyy.is.possibleFunc(v), {});
|
|
594
|
+
}
|
|
595
|
+
/** @inheritDoc */
|
|
596
|
+
possibleFuncOptional(value, opt) {
|
|
597
|
+
this._optional(value, () => this.possibleFunc(value, opt));
|
|
598
|
+
}
|
|
599
|
+
/** @inheritDoc */
|
|
600
|
+
possibleFuncArray(value, opt) {
|
|
601
|
+
this._array(value, opt, 'invalid.possibleFunc.array', (v) => this.lyy.is.possibleFunc(v));
|
|
602
|
+
}
|
|
603
|
+
// endregion possibleFunc
|
|
604
|
+
// region boolean
|
|
605
|
+
/** @inheritDoc */
|
|
606
|
+
boolean(value, opt) {
|
|
607
|
+
this._is(value, opt, 'invalid.boolean', v => this.lyy.is.boolean(v), {});
|
|
608
|
+
}
|
|
609
|
+
/** @inheritDoc */
|
|
610
|
+
booleanOptional(value, opt) {
|
|
611
|
+
this._optional(value, () => this.boolean(value, opt));
|
|
612
|
+
}
|
|
613
|
+
/** @inheritDoc */
|
|
614
|
+
booleanArray(value, opt) {
|
|
615
|
+
this._array(value, opt, 'invalid.boolean.array', (v) => this.lyy.is.boolean(v));
|
|
616
|
+
}
|
|
617
|
+
// endregion boolean
|
|
618
|
+
// region enum
|
|
619
|
+
/** @inheritDoc */
|
|
620
|
+
enum(value, map, opt) {
|
|
621
|
+
this._is(value, opt, 'invalid.enum', v => this.lyy.is.enumeration(v, map), {});
|
|
622
|
+
}
|
|
623
|
+
/** @inheritDoc */
|
|
624
|
+
enumOptional(value, map, opt) {
|
|
625
|
+
this._optional(value, () => this.enum(value, map, opt));
|
|
626
|
+
}
|
|
627
|
+
/** @inheritDoc */
|
|
628
|
+
enumArray(value, map, opt) {
|
|
629
|
+
this._array(value, opt, 'invalid.enum.array', (v) => this.lyy.is.enumeration(v, map));
|
|
630
|
+
}
|
|
631
|
+
// endregion enum
|
|
632
|
+
// region literal
|
|
633
|
+
/** @inheritDoc */
|
|
634
|
+
literal(value, items, opt) {
|
|
635
|
+
this._is(value, opt, 'invalid.literal', v => this.lyy.is.literal(v, items), {});
|
|
636
|
+
}
|
|
637
|
+
/** @inheritDoc */
|
|
638
|
+
literalOptional(value, items, opt) {
|
|
639
|
+
this._optional(value, () => this.literal(value, items, opt));
|
|
640
|
+
}
|
|
641
|
+
/** @inheritDoc */
|
|
642
|
+
literalArray(value, items, opt) {
|
|
643
|
+
this._array(value, opt, 'invalid.literal.array', (v) => this.lyy.is.literal(v, items));
|
|
160
644
|
}
|
|
161
|
-
// endregion
|
|
645
|
+
// endregion literal
|
|
162
646
|
// region secure
|
|
163
647
|
/** @inheritDoc */
|
|
164
648
|
get $back() {
|
|
165
649
|
return this;
|
|
166
650
|
}
|
|
167
651
|
/** @inheritDoc */
|
|
168
|
-
$init(
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
leyyo.fqn.register(null, CommonAssertion, 'class', internal_1.FQN_PCK);
|
|
652
|
+
$init() {
|
|
653
|
+
this.lyy.$secure.$lazyRun(() => {
|
|
654
|
+
this.lyy.fqn.register(null, CommonAssertion, 'class', internal_1.FQN);
|
|
172
655
|
});
|
|
173
656
|
}
|
|
174
657
|
/** @inheritDoc */
|