@leyyo/common 1.0.13 → 1.2.2
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/deploy/deploy.common.d.ts +12 -7
- package/dist/deploy/deploy.common.js +29 -10
- package/dist/deploy/deploy.common.js.map +1 -1
- package/dist/deploy/index.types.d.ts +12 -8
- package/dist/error/error.common.d.ts +12 -20
- package/dist/error/error.common.js +151 -85
- package/dist/error/error.common.js.map +1 -1
- package/dist/error/http-error.map.d.ts +6 -0
- package/dist/error/http-error.map.js +25 -0
- package/dist/error/http-error.map.js.map +1 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.js +2 -0
- package/dist/error/index.js.map +1 -1
- package/dist/error/index.types.d.ts +35 -36
- package/dist/error/items/bad-request.error.d.ts +10 -0
- package/dist/error/items/bad-request.error.js +16 -0
- package/dist/error/items/bad-request.error.js.map +1 -0
- package/dist/error/items/caused.error.d.ts +8 -0
- package/dist/error/items/caused.error.js +16 -0
- package/dist/error/items/caused.error.js.map +1 -0
- package/dist/error/items/conflict.error.d.ts +10 -0
- package/dist/error/items/conflict.error.js +16 -0
- package/dist/error/items/conflict.error.js.map +1 -0
- package/dist/error/items/content-too-large.error.d.ts +10 -0
- package/dist/error/items/content-too-large.error.js +16 -0
- package/dist/error/items/content-too-large.error.js.map +1 -0
- package/dist/error/items/developer.error.d.ts +4 -0
- package/dist/error/items/developer.error.js +9 -0
- package/dist/error/items/developer.error.js.map +1 -0
- package/dist/error/items/forbidden.error.d.ts +10 -0
- package/dist/error/items/forbidden.error.js +16 -0
- package/dist/error/items/forbidden.error.js.map +1 -0
- package/dist/error/items/gone.error.d.ts +10 -0
- package/dist/error/items/gone.error.js +16 -0
- package/dist/error/items/gone.error.js.map +1 -0
- package/dist/error/items/http.error.d.ts +15 -0
- package/dist/error/items/http.error.js +21 -0
- package/dist/error/items/http.error.js.map +1 -0
- package/dist/error/items/index.d.ts +21 -0
- package/dist/error/items/index.js +38 -0
- package/dist/error/items/index.js.map +1 -0
- package/dist/error/items/invalid-value.error.d.ts +6 -0
- package/dist/error/items/invalid-value.error.js +11 -0
- package/dist/error/items/invalid-value.error.js.map +1 -0
- package/dist/error/items/length-required.error.d.ts +10 -0
- package/dist/error/items/length-required.error.js +16 -0
- package/dist/error/items/length-required.error.js.map +1 -0
- package/dist/error/items/leyyo.error.d.ts +50 -0
- package/dist/error/items/leyyo.error.js +98 -0
- package/dist/error/items/leyyo.error.js.map +1 -0
- package/dist/error/items/method-not-allowed.error.d.ts +10 -0
- package/dist/error/items/method-not-allowed.error.js +16 -0
- package/dist/error/items/method-not-allowed.error.js.map +1 -0
- package/dist/error/items/multiple.error.d.ts +11 -0
- package/dist/error/items/multiple.error.js +34 -0
- package/dist/error/items/multiple.error.js.map +1 -0
- package/dist/error/items/not-acceptable.error.d.ts +10 -0
- package/dist/error/items/not-acceptable.error.js +16 -0
- package/dist/error/items/not-acceptable.error.js.map +1 -0
- package/dist/error/items/not-found.error.d.ts +10 -0
- package/dist/error/items/not-found.error.js +16 -0
- package/dist/error/items/not-found.error.js.map +1 -0
- package/dist/error/items/payment-required.error.d.ts +10 -0
- package/dist/error/items/payment-required.error.js +16 -0
- package/dist/error/items/payment-required.error.js.map +1 -0
- package/dist/error/items/precondition-failed.error.d.ts +10 -0
- package/dist/error/items/precondition-failed.error.js +16 -0
- package/dist/error/items/precondition-failed.error.js.map +1 -0
- package/dist/error/items/proxy-authentication-required.error.d.ts +10 -0
- package/dist/error/items/proxy-authentication-required.error.js +16 -0
- package/dist/error/items/proxy-authentication-required.error.js.map +1 -0
- package/dist/error/items/request-timeout.error.d.ts +10 -0
- package/dist/error/items/request-timeout.error.js +16 -0
- package/dist/error/items/request-timeout.error.js.map +1 -0
- package/dist/error/items/silent.error.d.ts +11 -0
- package/dist/error/items/silent.error.js +19 -0
- package/dist/error/items/silent.error.js.map +1 -0
- package/dist/error/items/unauthorized.error.d.ts +10 -0
- package/dist/error/items/unauthorized.error.js +16 -0
- package/dist/error/items/unauthorized.error.js.map +1 -0
- package/dist/event/event.common.d.ts +77 -0
- package/dist/event/event.common.js +308 -0
- package/dist/event/event.common.js.map +1 -0
- package/dist/event/event.error.d.ts +3 -0
- package/dist/event/event.error.js +8 -0
- package/dist/event/event.error.js.map +1 -0
- package/dist/event/index.js.map +1 -0
- package/dist/event/index.types.d.ts +261 -0
- package/dist/{hook → event}/index.types.js.map +1 -1
- package/dist/hub/hub.channel.d.ts +27 -0
- package/dist/hub/hub.channel.js +83 -0
- package/dist/hub/hub.channel.js.map +1 -0
- package/dist/hub/hub.common.d.ts +27 -0
- package/dist/hub/hub.common.js +92 -0
- package/dist/hub/hub.common.js.map +1 -0
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/index.types.d.ts +105 -0
- package/dist/{to → hub}/index.types.js.map +1 -1
- package/dist/index.d.ts +5 -23
- package/dist/index.js +7 -25
- package/dist/index.js.map +1 -1
- package/dist/leyyo/index.d.ts +0 -1
- package/dist/leyyo/index.js +0 -1
- package/dist/leyyo/index.js.map +1 -1
- package/dist/leyyo/index.types.d.ts +4 -22
- package/dist/leyyo/leyyo.d.ts +4 -22
- package/dist/leyyo/leyyo.js +12 -39
- package/dist/leyyo/leyyo.js.map +1 -1
- package/dist/log/index.types.d.ts +19 -26
- package/dist/log/log.common.d.ts +1 -1
- package/dist/log/log.common.js +24 -49
- package/dist/log/log.common.js.map +1 -1
- package/dist/log/logger.error.d.ts +3 -0
- package/dist/log/logger.error.js +8 -0
- package/dist/log/logger.error.js.map +1 -0
- package/dist/log/logger.instance.d.ts +7 -9
- package/dist/log/logger.instance.js +40 -50
- package/dist/log/logger.instance.js.map +1 -1
- package/dist/name/index.types.d.ts +1 -1
- package/dist/name/name.common.js +64 -37
- package/dist/name/name.common.js.map +1 -1
- package/dist/name/name.error.d.ts +3 -0
- package/dist/name/name.error.js +8 -0
- package/dist/name/name.error.js.map +1 -0
- package/dist/opt/index.js.map +1 -0
- package/dist/opt/index.types.d.ts +33 -0
- package/dist/{fqn → opt}/index.types.js.map +1 -1
- package/dist/opt/opt.common.d.ts +15 -0
- package/dist/opt/opt.common.js +93 -0
- package/dist/opt/opt.common.js.map +1 -0
- package/dist/repo/index.types.d.ts +1 -19
- package/dist/repo/repo.common.d.ts +0 -6
- package/dist/repo/repo.common.js +0 -20
- package/dist/repo/repo.common.js.map +1 -1
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.enum.d.ts +7 -0
- package/dist/{exception/index.types.js → shared/index.enum.js} +1 -1
- package/dist/shared/index.enum.js.map +1 -0
- package/dist/shared/index.fqn.d.ts +3 -0
- package/dist/shared/index.fqn.js +3 -0
- package/dist/shared/index.fqn.js.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.json.d.ts +33 -0
- package/dist/shared/index.json.js +3 -0
- package/dist/shared/index.json.js.map +1 -0
- package/dist/shared/index.types.d.ts +78 -100
- package/dist/shared/index.types.js +31 -0
- package/dist/shared/index.types.js.map +1 -1
- package/dist/util/delay.d.ts +9 -0
- package/dist/util/delay.js +21 -0
- package/dist/util/delay.js.map +1 -0
- package/dist/util/empty.fn.d.ts +8 -0
- package/dist/util/empty.fn.js +11 -0
- package/dist/util/empty.fn.js.map +1 -0
- package/dist/util/index.d.ts +5 -0
- package/dist/{developer → util}/index.js +5 -2
- package/dist/util/index.js.map +1 -0
- package/dist/util/one-or-more.d.ts +8 -0
- package/dist/util/one-or-more.js +19 -0
- package/dist/util/one-or-more.js.map +1 -0
- package/dist/util/secure-clone.d.ts +3 -0
- package/dist/util/secure-clone.js +38 -0
- package/dist/util/secure-clone.js.map +1 -0
- package/dist/util/secure-json.d.ts +37 -0
- package/dist/util/secure-json.js +126 -0
- package/dist/util/secure-json.js.map +1 -0
- package/package.json +2 -2
- package/dist/assertion/assertion.common.d.ts +0 -183
- package/dist/assertion/assertion.common.js +0 -663
- package/dist/assertion/assertion.common.js.map +0 -1
- package/dist/assertion/index.js.map +0 -1
- package/dist/assertion/index.types.d.ts +0 -661
- package/dist/assertion/index.types.js.map +0 -1
- package/dist/descriptor/descriptor.common.d.ts +0 -22
- package/dist/descriptor/descriptor.common.js +0 -117
- package/dist/descriptor/descriptor.common.js.map +0 -1
- package/dist/descriptor/index.js.map +0 -1
- package/dist/descriptor/index.types.d.ts +0 -23
- package/dist/descriptor/index.types.js.map +0 -1
- package/dist/developer/developer.common.d.ts +0 -32
- package/dist/developer/developer.common.js +0 -245
- package/dist/developer/developer.common.js.map +0 -1
- package/dist/developer/index.d.ts +0 -2
- package/dist/developer/index.errors.d.ts +0 -13
- package/dist/developer/index.errors.js +0 -24
- package/dist/developer/index.errors.js.map +0 -1
- package/dist/developer/index.js.map +0 -1
- package/dist/developer/index.types.d.ts +0 -85
- package/dist/developer/index.types.js.map +0 -1
- package/dist/exception/assertion.exception.d.ts +0 -5
- package/dist/exception/assertion.exception.js +0 -12
- package/dist/exception/assertion.exception.js.map +0 -1
- package/dist/exception/caused.exception.d.ts +0 -5
- package/dist/exception/caused.exception.js +0 -13
- package/dist/exception/caused.exception.js.map +0 -1
- package/dist/exception/developer.exception.d.ts +0 -5
- package/dist/exception/developer.exception.js +0 -12
- package/dist/exception/developer.exception.js.map +0 -1
- package/dist/exception/exception.d.ts +0 -32
- package/dist/exception/exception.js +0 -117
- package/dist/exception/exception.js.map +0 -1
- package/dist/exception/index.d.ts +0 -7
- package/dist/exception/index.js +0 -24
- package/dist/exception/index.js.map +0 -1
- package/dist/exception/index.types.d.ts +0 -30
- package/dist/exception/index.types.js.map +0 -1
- package/dist/exception/invalid-value.exception.d.ts +0 -5
- package/dist/exception/invalid-value.exception.js +0 -12
- package/dist/exception/invalid-value.exception.js.map +0 -1
- package/dist/exception/multiple.exception.d.ts +0 -8
- package/dist/exception/multiple.exception.js +0 -34
- package/dist/exception/multiple.exception.js.map +0 -1
- package/dist/fqn/fqn.common.d.ts +0 -20
- package/dist/fqn/fqn.common.js +0 -123
- package/dist/fqn/fqn.common.js.map +0 -1
- package/dist/fqn/index.js.map +0 -1
- package/dist/fqn/index.types.d.ts +0 -20
- package/dist/fqn/index.types.js +0 -3
- package/dist/hook/hook.common.d.ts +0 -25
- package/dist/hook/hook.common.js +0 -95
- package/dist/hook/hook.common.js.map +0 -1
- package/dist/hook/index.d.ts +0 -1
- package/dist/hook/index.js +0 -18
- package/dist/hook/index.js.map +0 -1
- package/dist/hook/index.types.d.ts +0 -72
- package/dist/hook/index.types.js +0 -3
- package/dist/is/index.d.ts +0 -1
- package/dist/is/index.js +0 -18
- package/dist/is/index.js.map +0 -1
- package/dist/is/index.types.d.ts +0 -240
- package/dist/is/index.types.js +0 -3
- package/dist/is/index.types.js.map +0 -1
- package/dist/is/is.common.d.ts +0 -71
- package/dist/is/is.common.js +0 -177
- package/dist/is/is.common.js.map +0 -1
- package/dist/leyyo/leyyo-hook.common.d.ts +0 -10
- package/dist/leyyo/leyyo-hook.common.js +0 -18
- package/dist/leyyo/leyyo-hook.common.js.map +0 -1
- package/dist/mixin/index.d.ts +0 -1
- package/dist/mixin/index.js +0 -18
- package/dist/mixin/index.js.map +0 -1
- package/dist/mixin/index.types.d.ts +0 -19
- package/dist/mixin/index.types.js +0 -3
- package/dist/mixin/index.types.js.map +0 -1
- package/dist/mixin/mixin.common.d.ts +0 -22
- package/dist/mixin/mixin.common.js +0 -165
- package/dist/mixin/mixin.common.js.map +0 -1
- package/dist/system/country-code.d.ts +0 -10
- package/dist/system/country-code.js +0 -19
- package/dist/system/country-code.js.map +0 -1
- package/dist/system/environment.d.ts +0 -7
- package/dist/system/environment.js +0 -6
- package/dist/system/environment.js.map +0 -1
- package/dist/system/index.d.ts +0 -7
- package/dist/system/index.js +0 -24
- package/dist/system/index.js.map +0 -1
- package/dist/system/index.types.d.ts +0 -6
- package/dist/system/index.types.js +0 -3
- package/dist/system/index.types.js.map +0 -1
- package/dist/system/language-code.d.ts +0 -7
- package/dist/system/language-code.js +0 -11
- package/dist/system/language-code.js.map +0 -1
- package/dist/system/locale-code.d.ts +0 -9
- package/dist/system/locale-code.js +0 -16
- package/dist/system/locale-code.js.map +0 -1
- package/dist/system/sys-class.d.ts +0 -4
- package/dist/system/sys-class.js +0 -21
- package/dist/system/sys-class.js.map +0 -1
- package/dist/system/sys-function.d.ts +0 -4
- package/dist/system/sys-function.js +0 -8
- package/dist/system/sys-function.js.map +0 -1
- package/dist/system/system.common.d.ts +0 -11
- package/dist/system/system.common.js +0 -64
- package/dist/system/system.common.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.js +0 -19
- package/dist/test/index.js.map +0 -1
- package/dist/test/index.types.d.ts +0 -9
- package/dist/test/index.types.js +0 -3
- package/dist/test/index.types.js.map +0 -1
- package/dist/test/test.common.d.ts +0 -14
- package/dist/test/test.common.js +0 -48
- package/dist/test/test.common.js.map +0 -1
- package/dist/test/tested.d.ts +0 -1
- package/dist/test/tested.js +0 -9
- package/dist/test/tested.js.map +0 -1
- package/dist/to/index.d.ts +0 -7
- package/dist/to/index.js +0 -24
- package/dist/to/index.js.map +0 -1
- package/dist/to/index.types.d.ts +0 -76
- package/dist/to/index.types.js +0 -3
- package/dist/to/key-value.d.ts +0 -4
- package/dist/to/key-value.js +0 -8
- package/dist/to/key-value.js.map +0 -1
- package/dist/to/list.d.ts +0 -20
- package/dist/to/list.js +0 -38
- package/dist/to/list.js.map +0 -1
- package/dist/to/primitive.d.ts +0 -7
- package/dist/to/primitive.js +0 -6
- package/dist/to/primitive.js.map +0 -1
- package/dist/to/real-value.d.ts +0 -7
- package/dist/to/real-value.js +0 -6
- package/dist/to/real-value.js.map +0 -1
- package/dist/to/to.common.d.ts +0 -77
- package/dist/to/to.common.js +0 -1079
- package/dist/to/to.common.js.map +0 -1
- package/dist/to/weak-false.d.ts +0 -7
- package/dist/to/weak-false.js +0 -6
- package/dist/to/weak-false.js.map +0 -1
- package/dist/to/weak-true.d.ts +0 -7
- package/dist/to/weak-true.js +0 -9
- package/dist/to/weak-true.js.map +0 -1
- package/dist/wrapper/index.d.ts +0 -2
- package/dist/wrapper/index.js +0 -19
- package/dist/wrapper/index.js.map +0 -1
- package/dist/wrapper/index.types.d.ts +0 -29
- package/dist/wrapper/index.types.js +0 -3
- package/dist/wrapper/index.types.js.map +0 -1
- package/dist/wrapper/wrap.d.ts +0 -7
- package/dist/wrapper/wrap.js +0 -11
- package/dist/wrapper/wrap.js.map +0 -1
- package/dist/wrapper/wrapper.common.d.ts +0 -26
- package/dist/wrapper/wrapper.common.js +0 -82
- package/dist/wrapper/wrapper.common.js.map +0 -1
- /package/dist/{assertion → event}/index.d.ts +0 -0
- /package/dist/{assertion → event}/index.js +0 -0
- /package/dist/{assertion → event}/index.types.js +0 -0
- /package/dist/{descriptor → hub}/index.d.ts +0 -0
- /package/dist/{descriptor → hub}/index.js +0 -0
- /package/dist/{descriptor → hub}/index.types.js +0 -0
- /package/dist/{fqn → opt}/index.d.ts +0 -0
- /package/dist/{fqn → opt}/index.js +0 -0
- /package/dist/{developer → opt}/index.types.js +0 -0
|
@@ -1,663 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssertionCommon = void 0;
|
|
4
|
-
const internal_1 = require("../internal");
|
|
5
|
-
// noinspection JSUnusedGlobalSymbols
|
|
6
|
-
/** @inheritDoc */
|
|
7
|
-
class AssertionCommon {
|
|
8
|
-
// endregion properties
|
|
9
|
-
constructor(lyy) {
|
|
10
|
-
this.lyy = lyy;
|
|
11
|
-
// region properties
|
|
12
|
-
this._EMPTY = [null, undefined];
|
|
13
|
-
}
|
|
14
|
-
// region internal
|
|
15
|
-
_run(opt) {
|
|
16
|
-
if (typeof opt === 'string') {
|
|
17
|
-
return { issue: opt };
|
|
18
|
-
}
|
|
19
|
-
else if (typeof opt === 'function') {
|
|
20
|
-
try {
|
|
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
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
const now = Date.now();
|
|
39
|
-
return {
|
|
40
|
-
message: e.message,
|
|
41
|
-
[`e-${now}-name`]: e.name,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return ((opt === null || opt === void 0 ? void 0 : opt.contructor) === Object) ? opt : {};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
_optional(value, fn) {
|
|
50
|
-
if (this._EMPTY.includes(value)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
fn();
|
|
54
|
-
}
|
|
55
|
-
_array(value, opt, issue, fn) {
|
|
56
|
-
if (!Array.isArray(value)) {
|
|
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 });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
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));
|
|
71
|
-
}
|
|
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
|
|
184
|
-
/** @inheritDoc */
|
|
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;
|
|
210
|
-
}
|
|
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) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (!firstError) {
|
|
221
|
-
firstError = this.lyy.dev.invalidError(this._run(opt), { issue, value: method });
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (firstError) {
|
|
226
|
-
throw firstError;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
/** @inheritDoc */
|
|
230
|
-
orCaseOptional(value, types, opt) {
|
|
231
|
-
this._optional(value, () => this.orCase(value, types, opt));
|
|
232
|
-
}
|
|
233
|
-
/** @inheritDoc */
|
|
234
|
-
orCaseArray(value, types, opt) {
|
|
235
|
-
this._array(value, opt, 'invalid.orCase.array', (v) => this._isOrCase(v, types));
|
|
236
|
-
}
|
|
237
|
-
// endregion or
|
|
238
|
-
// region realValue
|
|
239
|
-
/** @inheritDoc */
|
|
240
|
-
realValue(value, opt) {
|
|
241
|
-
this._is(value, opt, 'invalid.realValue', v => this.lyy.is.realValue(v), {});
|
|
242
|
-
}
|
|
243
|
-
/** @inheritDoc */
|
|
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
|
-
});
|
|
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));
|
|
395
|
-
}
|
|
396
|
-
// endregion primitive
|
|
397
|
-
// region key
|
|
398
|
-
/** @inheritDoc */
|
|
399
|
-
key(value, opt) {
|
|
400
|
-
this._is(value, opt, 'invalid.key', v => this.lyy.is.key(v), {});
|
|
401
|
-
}
|
|
402
|
-
/** @inheritDoc */
|
|
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));
|
|
447
|
-
}
|
|
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 */
|
|
455
|
-
number(value, opt) {
|
|
456
|
-
this._is(value, opt, 'invalid.number', v => this.lyy.is.number(v), {});
|
|
457
|
-
}
|
|
458
|
-
/** @inheritDoc */
|
|
459
|
-
numberOptional(value, opt) {
|
|
460
|
-
this._optional(value, () => this.number(value, opt));
|
|
461
|
-
}
|
|
462
|
-
/** @inheritDoc */
|
|
463
|
-
numberArray(value, opt) {
|
|
464
|
-
this._array(value, opt, 'invalid.number.array', (v) => this.lyy.is.number(v));
|
|
465
|
-
}
|
|
466
|
-
// endregion number
|
|
467
|
-
// region positiveNumber
|
|
468
|
-
/** @inheritDoc */
|
|
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));
|
|
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
|
|
510
|
-
/** @inheritDoc */
|
|
511
|
-
safeInteger(value, opt) {
|
|
512
|
-
this._is(value, opt, 'invalid.safeInteger', v => this.lyy.is.safeInteger(v), {});
|
|
513
|
-
}
|
|
514
|
-
/** @inheritDoc */
|
|
515
|
-
safeIntegerOptional(value, opt) {
|
|
516
|
-
this._optional(value, () => this.safeInteger(value, opt));
|
|
517
|
-
}
|
|
518
|
-
/** @inheritDoc */
|
|
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));
|
|
546
|
-
}
|
|
547
|
-
// endregion nonNegativeInteger
|
|
548
|
-
// region string
|
|
549
|
-
/** @inheritDoc */
|
|
550
|
-
string(value, opt) {
|
|
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));
|
|
556
|
-
}
|
|
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 */
|
|
564
|
-
text(value, opt) {
|
|
565
|
-
this._is(value, opt, 'invalid.text', v => this.lyy.is.text(v), {});
|
|
566
|
-
}
|
|
567
|
-
/** @inheritDoc */
|
|
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));
|
|
644
|
-
}
|
|
645
|
-
// endregion literal
|
|
646
|
-
// region secure
|
|
647
|
-
/** @inheritDoc */
|
|
648
|
-
get $back() {
|
|
649
|
-
return this;
|
|
650
|
-
}
|
|
651
|
-
/** @inheritDoc */
|
|
652
|
-
$init() {
|
|
653
|
-
this.lyy.$secure.$lazyRun(() => {
|
|
654
|
-
this.lyy.fqn.register(null, AssertionCommon, 'class', internal_1.FQN);
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
/** @inheritDoc */
|
|
658
|
-
get $secure() {
|
|
659
|
-
return this;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
exports.AssertionCommon = AssertionCommon;
|
|
663
|
-
//# sourceMappingURL=assertion.common.js.map
|