@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
package/dist/to/to.common.js
DELETED
|
@@ -1,1079 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToCommon = void 0;
|
|
4
|
-
const leyyo_1 = require("../leyyo");
|
|
5
|
-
const internal_1 = require("../internal");
|
|
6
|
-
const primitive_1 = require("./primitive");
|
|
7
|
-
const real_value_1 = require("./real-value");
|
|
8
|
-
const key_value_1 = require("./key-value");
|
|
9
|
-
const weak_true_1 = require("./weak-true");
|
|
10
|
-
const weak_false_1 = require("./weak-false");
|
|
11
|
-
const list_1 = require("./list");
|
|
12
|
-
// noinspection JSUnusedGlobalSymbols
|
|
13
|
-
class ToCommon {
|
|
14
|
-
// endregion properties
|
|
15
|
-
constructor(lyy) {
|
|
16
|
-
this.lyy = lyy;
|
|
17
|
-
// region properties
|
|
18
|
-
this._EMPTY = [null, undefined];
|
|
19
|
-
this._EXPECTED_ANY = ['string', 'boolean', 'bigint', 'object', 'number', 'array'];
|
|
20
|
-
this._EXPECTED_ARRAY = ['array', 'Set', 'List'];
|
|
21
|
-
this._EXPECTED_BOOL = ['boolean', 'string', 'number'];
|
|
22
|
-
this._EXPECTED_DATE = ['string', 'number', 'date', 'moment'];
|
|
23
|
-
this._EXPECTED_ENUM = ['string', 'number'];
|
|
24
|
-
this._EXPECTED_NUMBER = ['string', 'number', 'bigint'];
|
|
25
|
-
this._EXPECTED_STRING = ['boolean', 'string', 'number'];
|
|
26
|
-
this._EXPECTED_OBJECT = ['object', 'Map'];
|
|
27
|
-
this._EXPECTED_FUNCTION = ['function', 'Wrap'];
|
|
28
|
-
}
|
|
29
|
-
// region secure
|
|
30
|
-
$init() {
|
|
31
|
-
this.lyy.$secure.$lazyRun(() => {
|
|
32
|
-
const enumMap = {
|
|
33
|
-
Primitive: primitive_1.PrimitiveItems,
|
|
34
|
-
RealValue: real_value_1.RealValueItems,
|
|
35
|
-
KeyValue: key_value_1.KeyValueItems,
|
|
36
|
-
WeakTrue: weak_true_1.WeakTrueItems,
|
|
37
|
-
WeakFalse: weak_false_1.WeakFalseItems,
|
|
38
|
-
};
|
|
39
|
-
for (const [name, value] of Object.entries(enumMap)) {
|
|
40
|
-
this.lyy.fqn.register(name, value, 'enum', internal_1.FQN);
|
|
41
|
-
this.lyy.hook.queueForCallback(leyyo_1.LeyyoHookCommon.enumPendingRegister, value);
|
|
42
|
-
}
|
|
43
|
-
}).$lazyRun(() => {
|
|
44
|
-
this.lyy.fqn.register(null, ToCommon, 'class', internal_1.FQN);
|
|
45
|
-
this.lyy.fqn.register(null, list_1.List, 'class', internal_1.FQN);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
get $back() {
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
get $secure() {
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
$runOpt(opt) {
|
|
55
|
-
if (typeof opt === 'function') {
|
|
56
|
-
try {
|
|
57
|
-
return opt();
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
const key = `<error>[${Date.now()}]`;
|
|
61
|
-
return {
|
|
62
|
-
[key]: [e.message, e.name],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else if (!this._EMPTY.includes(opt) || typeof opt !== 'object' || opt.constructor !== Object) {
|
|
67
|
-
const key = `<invalid-opt>[${Date.now()}]`;
|
|
68
|
-
return {
|
|
69
|
-
[key]: this.lyy.dev.secureJson(opt, true),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
return opt;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
$runFn(fn, value, opt) {
|
|
77
|
-
try {
|
|
78
|
-
return fn(value());
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
return this.$errorOrLog(opt, undefined, e);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
$errorOrLog(opt, extra, e) {
|
|
85
|
-
var _a;
|
|
86
|
-
const newOpt = (_a = this.$runOpt(opt)) !== null && _a !== void 0 ? _a : {};
|
|
87
|
-
if (!newOpt.silent) {
|
|
88
|
-
delete newOpt.silent;
|
|
89
|
-
if (e instanceof Error) {
|
|
90
|
-
throw this.lyy.dev.nativeError(e, newOpt, extra);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
throw this.lyy.dev.invalidError(newOpt, extra);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
if (e instanceof Error) {
|
|
98
|
-
this.lyy.dev.log(e, newOpt, 'warn');
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
this.lyy.dev.log(this.lyy.dev.appendAll(newOpt, extra), 'warn');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
$unexpectedError(value, expected, opt) {
|
|
107
|
-
return this.$errorOrLog(opt, { expected, type: typeof value, value });
|
|
108
|
-
}
|
|
109
|
-
$nullError(expected, opt) {
|
|
110
|
-
return this.$errorOrLog(opt, { issue: 'null', expected });
|
|
111
|
-
}
|
|
112
|
-
$emptyError(kind, opt) {
|
|
113
|
-
return this.$errorOrLog(opt, { issue: kind + '.size' });
|
|
114
|
-
}
|
|
115
|
-
$inEnumMap(value, map) {
|
|
116
|
-
// regular, in values
|
|
117
|
-
if (Object.values(map).includes(value)) {
|
|
118
|
-
return value;
|
|
119
|
-
}
|
|
120
|
-
// ir-regular, in keys
|
|
121
|
-
if (Object.keys(map).includes(value)) {
|
|
122
|
-
return map[value];
|
|
123
|
-
}
|
|
124
|
-
if (typeof value === 'string') {
|
|
125
|
-
// regular, in lower-case
|
|
126
|
-
let str = value.toLowerCase();
|
|
127
|
-
let v = this.$inEnumMap(str, map);
|
|
128
|
-
if (!this._EMPTY.includes(v)) {
|
|
129
|
-
return v;
|
|
130
|
-
}
|
|
131
|
-
// regular, in upper-case
|
|
132
|
-
str = str.toUpperCase();
|
|
133
|
-
v = this.$inEnumMap(str, map);
|
|
134
|
-
if (!this._EMPTY.includes(v)) {
|
|
135
|
-
return v;
|
|
136
|
-
}
|
|
137
|
-
if (/^[0-9]+$/.test(value)) {
|
|
138
|
-
try {
|
|
139
|
-
return this.$inEnumMap(parseInt(value, 10), map);
|
|
140
|
-
}
|
|
141
|
-
catch (e) {
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
|
-
$inEnumArray(value, arr) {
|
|
149
|
-
// regular, in values
|
|
150
|
-
if (arr.includes(value)) {
|
|
151
|
-
return value;
|
|
152
|
-
}
|
|
153
|
-
if (typeof value === 'string') {
|
|
154
|
-
// regular, in lower-case
|
|
155
|
-
let str = value.toLowerCase();
|
|
156
|
-
let v = this.$inEnumArray(str, arr);
|
|
157
|
-
if (!this._EMPTY.includes(v)) {
|
|
158
|
-
return v;
|
|
159
|
-
}
|
|
160
|
-
// regular, in upper-case
|
|
161
|
-
str = str.toUpperCase();
|
|
162
|
-
v = this.$inEnumArray(str, arr);
|
|
163
|
-
if (!this._EMPTY.includes(v)) {
|
|
164
|
-
return v;
|
|
165
|
-
}
|
|
166
|
-
if (/^[0-9]+$/.test(value)) {
|
|
167
|
-
try {
|
|
168
|
-
return this.$inEnumArray(parseInt(value, 10), arr);
|
|
169
|
-
}
|
|
170
|
-
catch (e) {
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|
|
177
|
-
// noinspection JSMethodCanBeStatic
|
|
178
|
-
$inEnumAlteration(value, alt) {
|
|
179
|
-
// ir-regular, in keys
|
|
180
|
-
if (Object.keys(alt).includes(value)) {
|
|
181
|
-
return alt[value];
|
|
182
|
-
}
|
|
183
|
-
if (typeof value === 'string') {
|
|
184
|
-
// regular, in lower-case
|
|
185
|
-
let str = value.toLowerCase();
|
|
186
|
-
let v = this.$inEnumAlteration(str, alt);
|
|
187
|
-
if (!this._EMPTY.includes(v)) {
|
|
188
|
-
return v;
|
|
189
|
-
}
|
|
190
|
-
// regular, in upper-case
|
|
191
|
-
str = str.toUpperCase();
|
|
192
|
-
v = this.$inEnumAlteration(str, alt);
|
|
193
|
-
if (!this._EMPTY.includes(v)) {
|
|
194
|
-
return v;
|
|
195
|
-
}
|
|
196
|
-
if (/^[0-9]+$/.test(value)) {
|
|
197
|
-
try {
|
|
198
|
-
return this.$inEnumAlteration(parseInt(value, 10), alt);
|
|
199
|
-
}
|
|
200
|
-
catch (e) {
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
207
|
-
$realNumber(value, opt) {
|
|
208
|
-
if (isNaN(value) || !isFinite(value)) {
|
|
209
|
-
return this.$errorOrLog(opt, { issue: 'invalid.real.number', value, type: typeof value });
|
|
210
|
-
}
|
|
211
|
-
return value;
|
|
212
|
-
}
|
|
213
|
-
// endregion secure
|
|
214
|
-
// region types
|
|
215
|
-
anyStrict(value, opt) {
|
|
216
|
-
return this.any(value, opt, true);
|
|
217
|
-
}
|
|
218
|
-
any(value, opt, notNull) {
|
|
219
|
-
if (this._EMPTY.includes(value)) {
|
|
220
|
-
if (notNull) {
|
|
221
|
-
this.$nullError(this._EXPECTED_ANY, opt);
|
|
222
|
-
}
|
|
223
|
-
return value;
|
|
224
|
-
}
|
|
225
|
-
switch (typeof value) {
|
|
226
|
-
case 'string':
|
|
227
|
-
case 'boolean':
|
|
228
|
-
case 'bigint':
|
|
229
|
-
case 'object':
|
|
230
|
-
return value;
|
|
231
|
-
case 'number':
|
|
232
|
-
return this.$realNumber(value, opt);
|
|
233
|
-
case 'function':
|
|
234
|
-
return this.$runFn(v => this.any(v, opt, notNull), value, opt);
|
|
235
|
-
}
|
|
236
|
-
return this.$unexpectedError(value, this._EXPECTED_ANY, opt);
|
|
237
|
-
}
|
|
238
|
-
booleanStrict(value, opt) {
|
|
239
|
-
return this.boolean(value, opt, true);
|
|
240
|
-
}
|
|
241
|
-
boolean(value, opt, notNull) {
|
|
242
|
-
if (this._EMPTY.includes(value)) {
|
|
243
|
-
if (notNull) {
|
|
244
|
-
this.$nullError(this._EXPECTED_BOOL, opt);
|
|
245
|
-
}
|
|
246
|
-
return value;
|
|
247
|
-
}
|
|
248
|
-
switch (typeof value) {
|
|
249
|
-
case 'boolean':
|
|
250
|
-
return value;
|
|
251
|
-
case 'string':
|
|
252
|
-
value = value.trim().toLowerCase();
|
|
253
|
-
if (value === '') {
|
|
254
|
-
return undefined;
|
|
255
|
-
}
|
|
256
|
-
if (weak_true_1.WeakTrueItems.includes(value)) {
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
if (weak_false_1.WeakFalseItems.includes(value)) {
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
return this.$errorOrLog(opt, { issue: 'invalid.bool.text', value });
|
|
263
|
-
case 'number':
|
|
264
|
-
return value > 0;
|
|
265
|
-
case 'object':
|
|
266
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
267
|
-
return this.boolean(value[0], opt, notNull);
|
|
268
|
-
}
|
|
269
|
-
break;
|
|
270
|
-
case 'function':
|
|
271
|
-
return this.$runFn(v => this.boolean(v, opt, notNull), value, opt);
|
|
272
|
-
}
|
|
273
|
-
return this.$unexpectedError(value, this._EXPECTED_BOOL, opt);
|
|
274
|
-
}
|
|
275
|
-
dateStrict(value, opt) {
|
|
276
|
-
return this.date(value, opt, true);
|
|
277
|
-
}
|
|
278
|
-
date(value, opt, notNull) {
|
|
279
|
-
if (this._EMPTY.includes(value)) {
|
|
280
|
-
if (notNull) {
|
|
281
|
-
this.$nullError(this._EXPECTED_DATE, opt);
|
|
282
|
-
}
|
|
283
|
-
return value;
|
|
284
|
-
}
|
|
285
|
-
let fn;
|
|
286
|
-
switch (typeof value) {
|
|
287
|
-
case 'object':
|
|
288
|
-
if (value instanceof Date) {
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
else if (typeof value['toDate'] === 'function') {
|
|
292
|
-
fn = () => value['toDate']();
|
|
293
|
-
return this.$runFn(v => this.date(v, opt, notNull), fn, opt);
|
|
294
|
-
}
|
|
295
|
-
if (Array.isArray(value)) {
|
|
296
|
-
const arr = value;
|
|
297
|
-
if (arr.length === 1) {
|
|
298
|
-
return this.date(arr[0], opt, notNull);
|
|
299
|
-
}
|
|
300
|
-
if (arr.length > 1 && arr.length < 8) {
|
|
301
|
-
const [year, monthIndex, date, hours, minutes, seconds, ms] = arr;
|
|
302
|
-
fn = () => new Date(year, monthIndex, date, hours, minutes, seconds, ms);
|
|
303
|
-
return this.$runFn(v => this.date(v, opt, notNull), fn, opt);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
else if (value.id !== undefined) {
|
|
307
|
-
return this.date(value.id, opt, notNull);
|
|
308
|
-
}
|
|
309
|
-
break;
|
|
310
|
-
case 'string':
|
|
311
|
-
if (value.trim() === '') {
|
|
312
|
-
return undefined;
|
|
313
|
-
}
|
|
314
|
-
fn = () => new Date(value.trim());
|
|
315
|
-
return this.$runFn(v => this.date(v, opt, notNull), fn, opt);
|
|
316
|
-
case 'bigint':
|
|
317
|
-
fn = () => new Date(value.toString(10));
|
|
318
|
-
return this.$runFn(v => this.date(v, opt, notNull), fn, opt);
|
|
319
|
-
case 'number':
|
|
320
|
-
fn = () => new Date(value);
|
|
321
|
-
return this.$runFn(v => this.date(v, opt, notNull), fn, opt);
|
|
322
|
-
case 'function':
|
|
323
|
-
return this.$runFn(v => this.date(v, opt, notNull), value, opt);
|
|
324
|
-
}
|
|
325
|
-
return this.$unexpectedError(value, this._EXPECTED_DATE, opt);
|
|
326
|
-
}
|
|
327
|
-
enumerationStrict(value, map, opt, alt) {
|
|
328
|
-
return this.enumeration(value, map, opt, alt, true);
|
|
329
|
-
}
|
|
330
|
-
enumeration(value, map, opt, alt, notNull) {
|
|
331
|
-
if (this._EMPTY.includes(value)) {
|
|
332
|
-
if (notNull) {
|
|
333
|
-
this.$nullError(this._EXPECTED_ENUM, opt);
|
|
334
|
-
}
|
|
335
|
-
return value;
|
|
336
|
-
}
|
|
337
|
-
if (!this.lyy.is.bareObject(map)) {
|
|
338
|
-
return this.$errorOrLog(opt, { issue: 'invalid.enum.map', type: typeof map, map });
|
|
339
|
-
}
|
|
340
|
-
let v;
|
|
341
|
-
switch (typeof value) {
|
|
342
|
-
case 'string':
|
|
343
|
-
value = value.trim();
|
|
344
|
-
if (value === '') {
|
|
345
|
-
return undefined;
|
|
346
|
-
}
|
|
347
|
-
v = this.$inEnumMap(value, map);
|
|
348
|
-
if (!this._EMPTY.includes(v)) {
|
|
349
|
-
return v;
|
|
350
|
-
}
|
|
351
|
-
if (this.lyy.is.bareObject(alt)) {
|
|
352
|
-
v = this.$inEnumAlteration(value, alt);
|
|
353
|
-
if (!this._EMPTY.includes(v)) {
|
|
354
|
-
return v;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
358
|
-
case 'number':
|
|
359
|
-
const num = this.$realNumber(value, opt);
|
|
360
|
-
if (!this._EMPTY.includes(num)) {
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
v = this.$inEnumMap(value, map);
|
|
364
|
-
if (!this._EMPTY.includes(v)) {
|
|
365
|
-
return v;
|
|
366
|
-
}
|
|
367
|
-
if (this.lyy.is.bareObject(alt)) {
|
|
368
|
-
v = this.$inEnumAlteration(value, alt);
|
|
369
|
-
if (!this._EMPTY.includes(v)) {
|
|
370
|
-
return v;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
374
|
-
case 'object':
|
|
375
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
376
|
-
return this.enumeration(value[0], map, opt, alt, notNull);
|
|
377
|
-
}
|
|
378
|
-
return this.enumeration(value.id, map, opt, alt, notNull);
|
|
379
|
-
case 'function':
|
|
380
|
-
return this.$runFn(v => this.enumeration(v, map, opt, alt, notNull), value, opt);
|
|
381
|
-
}
|
|
382
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
383
|
-
}
|
|
384
|
-
literalStrict(value, items, opt, alt) {
|
|
385
|
-
return this.literal(value, items, opt, alt, true);
|
|
386
|
-
}
|
|
387
|
-
literal(value, items, opt, alt, notNull) {
|
|
388
|
-
if (this._EMPTY.includes(value)) {
|
|
389
|
-
if (notNull) {
|
|
390
|
-
this.$nullError(this._EXPECTED_ENUM, opt);
|
|
391
|
-
}
|
|
392
|
-
return value;
|
|
393
|
-
}
|
|
394
|
-
if (!Array.isArray(items)) {
|
|
395
|
-
return this.$errorOrLog(opt, { issue: 'invalid.enum.literal', type: typeof items, items });
|
|
396
|
-
}
|
|
397
|
-
let v;
|
|
398
|
-
switch (typeof value) {
|
|
399
|
-
case 'string':
|
|
400
|
-
value = value.trim();
|
|
401
|
-
if (value === '') {
|
|
402
|
-
return undefined;
|
|
403
|
-
}
|
|
404
|
-
v = this.$inEnumArray(value, items);
|
|
405
|
-
if (!this._EMPTY.includes(v)) {
|
|
406
|
-
return v;
|
|
407
|
-
}
|
|
408
|
-
if (this.lyy.is.bareObject(alt)) {
|
|
409
|
-
v = this.$inEnumAlteration(value, alt);
|
|
410
|
-
if (!this._EMPTY.includes(v)) {
|
|
411
|
-
return v;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
415
|
-
case 'number':
|
|
416
|
-
const num = this.$realNumber(value, opt);
|
|
417
|
-
if (!this._EMPTY.includes(num)) {
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
v = this.$inEnumArray(value, items);
|
|
421
|
-
if (!this._EMPTY.includes(v)) {
|
|
422
|
-
return v;
|
|
423
|
-
}
|
|
424
|
-
if (this.lyy.is.bareObject(alt)) {
|
|
425
|
-
v = this.$inEnumAlteration(value, alt);
|
|
426
|
-
if (!this._EMPTY.includes(v)) {
|
|
427
|
-
return v;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
431
|
-
case 'object':
|
|
432
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
433
|
-
return this.literal(value[0], items, opt, alt, notNull);
|
|
434
|
-
}
|
|
435
|
-
return this.literal(value.id, items, opt, alt, notNull);
|
|
436
|
-
case 'function':
|
|
437
|
-
return this.$runFn(v => this.literal(v, items, opt, alt, notNull), value, opt);
|
|
438
|
-
}
|
|
439
|
-
return this.$unexpectedError(value, this._EXPECTED_ENUM, opt);
|
|
440
|
-
}
|
|
441
|
-
floatStrict(value, opt) {
|
|
442
|
-
return this.float(value, opt, true);
|
|
443
|
-
}
|
|
444
|
-
float(value, opt, notNull) {
|
|
445
|
-
if (this._EMPTY.includes(value)) {
|
|
446
|
-
if (notNull) {
|
|
447
|
-
this.$nullError(this._EXPECTED_NUMBER, opt);
|
|
448
|
-
}
|
|
449
|
-
return value;
|
|
450
|
-
}
|
|
451
|
-
let fn;
|
|
452
|
-
switch (typeof value) {
|
|
453
|
-
case 'string':
|
|
454
|
-
fn = () => parseFloat(value);
|
|
455
|
-
return this.$runFn(v => this.float(v, opt, notNull), fn, opt);
|
|
456
|
-
case 'number':
|
|
457
|
-
return this.$realNumber(value, opt);
|
|
458
|
-
case 'bigint':
|
|
459
|
-
fn = () => Number(value);
|
|
460
|
-
return this.$runFn(v => this.float(v, opt, notNull), fn, opt);
|
|
461
|
-
case 'boolean':
|
|
462
|
-
return value ? 1 : 0;
|
|
463
|
-
case 'object':
|
|
464
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
465
|
-
return this.float(value[0], opt, notNull);
|
|
466
|
-
}
|
|
467
|
-
return this.float(value.id, opt, notNull);
|
|
468
|
-
case 'function':
|
|
469
|
-
return this.$runFn(v => this.float(v, opt, notNull), value, opt);
|
|
470
|
-
}
|
|
471
|
-
return this.$unexpectedError(value, this._EXPECTED_NUMBER, opt);
|
|
472
|
-
}
|
|
473
|
-
funcStrict(value, opt) {
|
|
474
|
-
return this.func(value, opt, true);
|
|
475
|
-
}
|
|
476
|
-
func(value, opt, notNull) {
|
|
477
|
-
if (this._EMPTY.includes(value)) {
|
|
478
|
-
if (notNull) {
|
|
479
|
-
this.$nullError(this._EXPECTED_FUNCTION, opt);
|
|
480
|
-
}
|
|
481
|
-
return value;
|
|
482
|
-
}
|
|
483
|
-
switch (typeof value) {
|
|
484
|
-
case "function":
|
|
485
|
-
return value;
|
|
486
|
-
case 'object':
|
|
487
|
-
if (this.lyy.wrapper.isFunction(value)) {
|
|
488
|
-
return this.lyy.wrapper.asFunction(value);
|
|
489
|
-
}
|
|
490
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
491
|
-
return this.func(value[0], opt, notNull);
|
|
492
|
-
}
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
return this.$unexpectedError(value, this._EXPECTED_FUNCTION, opt);
|
|
496
|
-
}
|
|
497
|
-
integerStrict(value, opt) {
|
|
498
|
-
return this.integer(value, opt, true);
|
|
499
|
-
}
|
|
500
|
-
integer(value, opt, notNull) {
|
|
501
|
-
if (this._EMPTY.includes(value)) {
|
|
502
|
-
if (notNull) {
|
|
503
|
-
this.$nullError(this._EXPECTED_NUMBER, opt);
|
|
504
|
-
}
|
|
505
|
-
return value;
|
|
506
|
-
}
|
|
507
|
-
let fn;
|
|
508
|
-
switch (typeof value) {
|
|
509
|
-
case 'string':
|
|
510
|
-
fn = () => parseInt(value);
|
|
511
|
-
return this.$runFn(v => this.integer(v, opt, notNull), fn, opt);
|
|
512
|
-
case 'number':
|
|
513
|
-
let num = this.$realNumber(value, opt);
|
|
514
|
-
if (num !== null && !Number.isSafeInteger(num)) {
|
|
515
|
-
num = Math.floor(num);
|
|
516
|
-
}
|
|
517
|
-
return num;
|
|
518
|
-
case 'bigint':
|
|
519
|
-
fn = () => Number(value);
|
|
520
|
-
return this.$runFn(v => this.integer(v, opt, notNull), fn, opt);
|
|
521
|
-
case 'boolean':
|
|
522
|
-
return value ? 1 : 0;
|
|
523
|
-
case 'object':
|
|
524
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
525
|
-
return this.integer(value[0], opt, notNull);
|
|
526
|
-
}
|
|
527
|
-
return this.integer(value.id, opt, notNull);
|
|
528
|
-
case 'function':
|
|
529
|
-
return this.$runFn(v => this.integer(v, opt, notNull), value, opt);
|
|
530
|
-
}
|
|
531
|
-
return this.$unexpectedError(value, this._EXPECTED_NUMBER, opt);
|
|
532
|
-
}
|
|
533
|
-
stringStrict(value, opt) {
|
|
534
|
-
return this.string(value, opt, true);
|
|
535
|
-
}
|
|
536
|
-
string(value, opt, notNull) {
|
|
537
|
-
if (this._EMPTY.includes(value)) {
|
|
538
|
-
if (notNull) {
|
|
539
|
-
this.$nullError(this._EXPECTED_STRING, opt);
|
|
540
|
-
}
|
|
541
|
-
return value;
|
|
542
|
-
}
|
|
543
|
-
switch (typeof value) {
|
|
544
|
-
case 'string':
|
|
545
|
-
return value;
|
|
546
|
-
case 'number':
|
|
547
|
-
const num = this.$realNumber(value, opt);
|
|
548
|
-
return this._EMPTY.includes(num) ? num : num.toString(10);
|
|
549
|
-
case 'bigint':
|
|
550
|
-
return value.toString();
|
|
551
|
-
case 'boolean':
|
|
552
|
-
return value ? 'true' : 'false';
|
|
553
|
-
case 'object':
|
|
554
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
555
|
-
return this.string(value[0], opt, notNull);
|
|
556
|
-
}
|
|
557
|
-
return this.string(value.id, opt, notNull);
|
|
558
|
-
case 'function':
|
|
559
|
-
return this.$runFn(v => this.string(v, opt, notNull), value, opt);
|
|
560
|
-
}
|
|
561
|
-
return this.$unexpectedError(value, this._EXPECTED_STRING, opt);
|
|
562
|
-
}
|
|
563
|
-
textStrict(value, opt) {
|
|
564
|
-
return this.text(value, opt, true);
|
|
565
|
-
}
|
|
566
|
-
text(value, opt, notNull) {
|
|
567
|
-
if (this._EMPTY.includes(value)) {
|
|
568
|
-
if (notNull) {
|
|
569
|
-
this.$nullError(this._EXPECTED_STRING, opt);
|
|
570
|
-
}
|
|
571
|
-
return value;
|
|
572
|
-
}
|
|
573
|
-
switch (typeof value) {
|
|
574
|
-
case 'string':
|
|
575
|
-
const str = value.trim();
|
|
576
|
-
if (str === '') {
|
|
577
|
-
if (notNull) {
|
|
578
|
-
this.$nullError(this._EXPECTED_STRING, opt);
|
|
579
|
-
}
|
|
580
|
-
return undefined;
|
|
581
|
-
}
|
|
582
|
-
return str;
|
|
583
|
-
case 'number':
|
|
584
|
-
const num = this.$realNumber(value, opt);
|
|
585
|
-
return this._EMPTY.includes(num) ? num : num.toString(10);
|
|
586
|
-
case 'bigint':
|
|
587
|
-
return value.toString();
|
|
588
|
-
case 'boolean':
|
|
589
|
-
return value ? 'true' : 'false';
|
|
590
|
-
case 'object':
|
|
591
|
-
if (Array.isArray(value) && value.length === 1) {
|
|
592
|
-
return this.text(value[0], opt, notNull);
|
|
593
|
-
}
|
|
594
|
-
return this.text(value.id, opt, notNull);
|
|
595
|
-
case 'function':
|
|
596
|
-
return this.$runFn(v => this.text(v, opt, notNull), value, opt);
|
|
597
|
-
}
|
|
598
|
-
return this.$unexpectedError(value, this._EXPECTED_STRING, opt);
|
|
599
|
-
}
|
|
600
|
-
// endregion types
|
|
601
|
-
// region objects
|
|
602
|
-
arrayStrict(value, opt, itemFn) {
|
|
603
|
-
return this.array(value, opt, itemFn, true);
|
|
604
|
-
}
|
|
605
|
-
arrayStrictNotEmpty(value, opt, itemFn) {
|
|
606
|
-
const result = this.array(value, opt, itemFn, true);
|
|
607
|
-
if (result.length < 1) {
|
|
608
|
-
this.$emptyError('array', opt);
|
|
609
|
-
}
|
|
610
|
-
return result;
|
|
611
|
-
}
|
|
612
|
-
arrayNotEmpty(value, opt, itemFn) {
|
|
613
|
-
const result = this.array(value, opt, itemFn, false);
|
|
614
|
-
if (result && result.length < 1) {
|
|
615
|
-
this.$emptyError('array', opt);
|
|
616
|
-
}
|
|
617
|
-
return result;
|
|
618
|
-
}
|
|
619
|
-
array(value, opt, itemFn, notNull) {
|
|
620
|
-
if (this._EMPTY.includes(value)) {
|
|
621
|
-
if (notNull) {
|
|
622
|
-
this.$nullError(this._EXPECTED_ARRAY, opt);
|
|
623
|
-
}
|
|
624
|
-
return value;
|
|
625
|
-
}
|
|
626
|
-
switch (typeof value) {
|
|
627
|
-
case "string":
|
|
628
|
-
case "boolean":
|
|
629
|
-
case "number":
|
|
630
|
-
case "bigint":
|
|
631
|
-
return this.array([value], opt, itemFn, notNull);
|
|
632
|
-
case 'object':
|
|
633
|
-
if (value instanceof Set) {
|
|
634
|
-
if (value.size < 1) {
|
|
635
|
-
return [];
|
|
636
|
-
}
|
|
637
|
-
return this.array(Array.from(value.values()), opt, itemFn, notNull);
|
|
638
|
-
}
|
|
639
|
-
else if (value instanceof list_1.List) {
|
|
640
|
-
if (value.length < 1) {
|
|
641
|
-
return [];
|
|
642
|
-
}
|
|
643
|
-
return this.array([...value], opt, itemFn, notNull);
|
|
644
|
-
}
|
|
645
|
-
if (Array.isArray(value)) {
|
|
646
|
-
if (typeof itemFn !== "function" || value.length < 1) {
|
|
647
|
-
return value;
|
|
648
|
-
}
|
|
649
|
-
const newOpt = this.$runOpt(opt);
|
|
650
|
-
const field = (typeof newOpt.field === 'string') ? newOpt.field : undefined;
|
|
651
|
-
const clonedOpt = Object.assign({}, newOpt);
|
|
652
|
-
return value.map((v, index) => {
|
|
653
|
-
clonedOpt.field = field ? `${field}#${index}` : `#${index}`;
|
|
654
|
-
try {
|
|
655
|
-
return itemFn(v, index, clonedOpt);
|
|
656
|
-
}
|
|
657
|
-
catch (e) {
|
|
658
|
-
if (newOpt.silent) {
|
|
659
|
-
this.lyy.dev.log(e, clonedOpt, 'warn');
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
throw this.lyy.dev.nativeError(e, clonedOpt);
|
|
663
|
-
}
|
|
664
|
-
return v;
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
return this.array([value], opt, itemFn, notNull);
|
|
669
|
-
case 'function':
|
|
670
|
-
return this.$runFn(v => this.array(v, opt, itemFn, notNull), value, opt);
|
|
671
|
-
}
|
|
672
|
-
return this.$unexpectedError(value, this._EXPECTED_ARRAY, opt);
|
|
673
|
-
}
|
|
674
|
-
delimitedStrict(value, opt, itemFn) {
|
|
675
|
-
return this.delimited(value, opt, itemFn, true);
|
|
676
|
-
}
|
|
677
|
-
delimitedStrictNotEmpty(value, opt, itemFn) {
|
|
678
|
-
const result = this.delimited(value, opt, itemFn, true);
|
|
679
|
-
if (result.length < 1) {
|
|
680
|
-
this.$emptyError('array', opt);
|
|
681
|
-
}
|
|
682
|
-
return result;
|
|
683
|
-
}
|
|
684
|
-
delimitedNotEmpty(value, opt, itemFn) {
|
|
685
|
-
const result = this.delimited(value, opt, itemFn, false);
|
|
686
|
-
if (result && result.length < 1) {
|
|
687
|
-
this.$emptyError('array', opt);
|
|
688
|
-
}
|
|
689
|
-
return result;
|
|
690
|
-
}
|
|
691
|
-
delimited(value, opt, itemFn, notNull) {
|
|
692
|
-
if (this._EMPTY.includes(value)) {
|
|
693
|
-
if (notNull) {
|
|
694
|
-
this.$nullError(this._EXPECTED_ARRAY, opt);
|
|
695
|
-
}
|
|
696
|
-
return value;
|
|
697
|
-
}
|
|
698
|
-
switch (typeof value) {
|
|
699
|
-
case "string":
|
|
700
|
-
return this.array(value.split(',').map(v => v.trim()), opt, itemFn, notNull);
|
|
701
|
-
case "boolean":
|
|
702
|
-
case "number":
|
|
703
|
-
case "bigint":
|
|
704
|
-
return this.array([value], opt, itemFn, notNull);
|
|
705
|
-
case 'object':
|
|
706
|
-
return this.array(value, opt, itemFn, notNull);
|
|
707
|
-
case 'function':
|
|
708
|
-
return this.$runFn(v => this.delimited(v, opt, itemFn, notNull), value, opt);
|
|
709
|
-
}
|
|
710
|
-
return this.$unexpectedError(value, this._EXPECTED_ARRAY, opt);
|
|
711
|
-
}
|
|
712
|
-
setStrict(value, opt, itemFn) {
|
|
713
|
-
return this.set(value, opt, itemFn, true);
|
|
714
|
-
}
|
|
715
|
-
setStrictNotEmpty(value, opt, itemFn) {
|
|
716
|
-
const result = this.set(value, opt, itemFn, true);
|
|
717
|
-
if (result.size < 1) {
|
|
718
|
-
this.$emptyError('set', opt);
|
|
719
|
-
}
|
|
720
|
-
return result;
|
|
721
|
-
}
|
|
722
|
-
setNotEmpty(value, opt, itemFn) {
|
|
723
|
-
const result = this.set(value, opt, itemFn, false);
|
|
724
|
-
if (result && result.size < 1) {
|
|
725
|
-
this.$emptyError('set', opt);
|
|
726
|
-
}
|
|
727
|
-
return result;
|
|
728
|
-
}
|
|
729
|
-
set(value, opt, itemFn, notNull) {
|
|
730
|
-
if (this._EMPTY.includes(value)) {
|
|
731
|
-
if (notNull) {
|
|
732
|
-
this.$nullError(this._EXPECTED_ARRAY, opt);
|
|
733
|
-
}
|
|
734
|
-
return value;
|
|
735
|
-
}
|
|
736
|
-
switch (typeof value) {
|
|
737
|
-
case "string":
|
|
738
|
-
case "boolean":
|
|
739
|
-
case "number":
|
|
740
|
-
case "bigint":
|
|
741
|
-
return this.set([value], opt, itemFn, notNull);
|
|
742
|
-
case 'object':
|
|
743
|
-
if (value instanceof Set) {
|
|
744
|
-
if (typeof itemFn !== "function" || value.size < 1) {
|
|
745
|
-
return value;
|
|
746
|
-
}
|
|
747
|
-
const clonedArr = this.array(Array.from(value.values()), opt, itemFn, notNull);
|
|
748
|
-
value.clear();
|
|
749
|
-
if (clonedArr) {
|
|
750
|
-
clonedArr.forEach(item => value.add(item));
|
|
751
|
-
}
|
|
752
|
-
return value;
|
|
753
|
-
}
|
|
754
|
-
else if (value instanceof list_1.List) {
|
|
755
|
-
if (value.length < 1) {
|
|
756
|
-
return new Set();
|
|
757
|
-
}
|
|
758
|
-
if (typeof itemFn !== "function") {
|
|
759
|
-
return new Set([...value]);
|
|
760
|
-
}
|
|
761
|
-
return new Set(this.array([...value], opt, itemFn, notNull));
|
|
762
|
-
}
|
|
763
|
-
if (Array.isArray(value)) {
|
|
764
|
-
if (value.length < 1) {
|
|
765
|
-
return new Set();
|
|
766
|
-
}
|
|
767
|
-
if (typeof itemFn !== "function") {
|
|
768
|
-
return new Set(value);
|
|
769
|
-
}
|
|
770
|
-
return new Set(this.array(value, opt, itemFn, notNull));
|
|
771
|
-
}
|
|
772
|
-
break;
|
|
773
|
-
case 'function':
|
|
774
|
-
return this.$runFn(v => this.set(v, opt, itemFn, notNull), value, opt);
|
|
775
|
-
}
|
|
776
|
-
return this.$unexpectedError(value, this._EXPECTED_ARRAY, opt);
|
|
777
|
-
}
|
|
778
|
-
listStrict(value, opt, itemFn) {
|
|
779
|
-
return this.list(value, opt, itemFn, true);
|
|
780
|
-
}
|
|
781
|
-
listStrictNotEmpty(value, opt, itemFn) {
|
|
782
|
-
const result = this.list(value, opt, itemFn, true);
|
|
783
|
-
if (result.length < 1) {
|
|
784
|
-
this.$emptyError('set', opt);
|
|
785
|
-
}
|
|
786
|
-
return result;
|
|
787
|
-
}
|
|
788
|
-
listNotEmpty(value, opt, itemFn) {
|
|
789
|
-
const result = this.list(value, opt, itemFn, false);
|
|
790
|
-
if (result && result.length < 1) {
|
|
791
|
-
this.$emptyError('set', opt);
|
|
792
|
-
}
|
|
793
|
-
return result;
|
|
794
|
-
}
|
|
795
|
-
list(value, opt, itemFn, notNull) {
|
|
796
|
-
if (this._EMPTY.includes(value)) {
|
|
797
|
-
if (notNull) {
|
|
798
|
-
this.$nullError(this._EXPECTED_ARRAY, opt);
|
|
799
|
-
}
|
|
800
|
-
return value;
|
|
801
|
-
}
|
|
802
|
-
switch (typeof value) {
|
|
803
|
-
case "string":
|
|
804
|
-
case "boolean":
|
|
805
|
-
case "number":
|
|
806
|
-
case "bigint":
|
|
807
|
-
return this.list([value], opt, itemFn, notNull);
|
|
808
|
-
case 'object':
|
|
809
|
-
if (value instanceof Set) {
|
|
810
|
-
const newList = new list_1.List();
|
|
811
|
-
if (value.size < 1) {
|
|
812
|
-
return newList;
|
|
813
|
-
}
|
|
814
|
-
if (typeof itemFn !== "function") {
|
|
815
|
-
newList.push(...Array.from(value.values()));
|
|
816
|
-
return newList;
|
|
817
|
-
}
|
|
818
|
-
const clonedArr = this.array(Array.from(value.values()), opt, itemFn, notNull);
|
|
819
|
-
if (clonedArr) {
|
|
820
|
-
newList.push(...clonedArr);
|
|
821
|
-
}
|
|
822
|
-
return newList;
|
|
823
|
-
}
|
|
824
|
-
else if (value instanceof list_1.List) {
|
|
825
|
-
if (typeof itemFn !== "function" || value.length < 1) {
|
|
826
|
-
return value;
|
|
827
|
-
}
|
|
828
|
-
const clonedArr = this.array([...value], opt, itemFn, notNull);
|
|
829
|
-
value.clear();
|
|
830
|
-
if (clonedArr) {
|
|
831
|
-
value.push(...clonedArr);
|
|
832
|
-
}
|
|
833
|
-
return value;
|
|
834
|
-
}
|
|
835
|
-
if (Array.isArray(value)) {
|
|
836
|
-
const newList = new list_1.List();
|
|
837
|
-
if (value.length < 1) {
|
|
838
|
-
return newList;
|
|
839
|
-
}
|
|
840
|
-
if (typeof itemFn !== "function") {
|
|
841
|
-
newList.push(...value);
|
|
842
|
-
return newList;
|
|
843
|
-
}
|
|
844
|
-
const clonedArr = this.array(value, opt, itemFn, notNull);
|
|
845
|
-
if (clonedArr) {
|
|
846
|
-
newList.push(...clonedArr);
|
|
847
|
-
}
|
|
848
|
-
return newList;
|
|
849
|
-
}
|
|
850
|
-
break;
|
|
851
|
-
case 'function':
|
|
852
|
-
return this.$runFn(v => this.list(v, opt, itemFn, notNull), value, opt);
|
|
853
|
-
}
|
|
854
|
-
return this.$unexpectedError(value, this._EXPECTED_ARRAY, opt);
|
|
855
|
-
}
|
|
856
|
-
objectStrict(value, opt) {
|
|
857
|
-
return this.object(value, opt, true);
|
|
858
|
-
}
|
|
859
|
-
object(value, opt, notNull) {
|
|
860
|
-
return this.dict(value, opt, undefined, undefined, notNull);
|
|
861
|
-
}
|
|
862
|
-
mapStrict(value, opt, valueFn, keyFn) {
|
|
863
|
-
return this.map(value, opt, valueFn, keyFn, true);
|
|
864
|
-
}
|
|
865
|
-
mapStrictNotEmpty(value, opt, valueFn, keyFn) {
|
|
866
|
-
const result = this.map(value, opt, valueFn, keyFn, true);
|
|
867
|
-
if (result.size < 1) {
|
|
868
|
-
this.$emptyError('map', opt);
|
|
869
|
-
}
|
|
870
|
-
return result;
|
|
871
|
-
}
|
|
872
|
-
mapNotEmpty(value, opt, valueFn, keyFn) {
|
|
873
|
-
const result = this.map(value, opt, valueFn, keyFn, false);
|
|
874
|
-
if (result && result.size < 1) {
|
|
875
|
-
this.$emptyError('map', opt);
|
|
876
|
-
}
|
|
877
|
-
return result;
|
|
878
|
-
}
|
|
879
|
-
map(value, opt, valueFn, keyFn, notNull) {
|
|
880
|
-
if (this._EMPTY.includes(value)) {
|
|
881
|
-
if (notNull) {
|
|
882
|
-
this.$nullError(this._EXPECTED_OBJECT, opt);
|
|
883
|
-
}
|
|
884
|
-
return value;
|
|
885
|
-
}
|
|
886
|
-
switch (typeof value) {
|
|
887
|
-
case 'object':
|
|
888
|
-
if (value instanceof Set) {
|
|
889
|
-
if (value.size === 1) {
|
|
890
|
-
return this.map(Array.from(value.values())[0], opt, valueFn, keyFn, notNull);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
else if (value instanceof list_1.List) {
|
|
894
|
-
if (value.length === 1) {
|
|
895
|
-
return this.map(value[0], opt, valueFn, keyFn, notNull);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
else if (value instanceof Map) {
|
|
899
|
-
if (typeof valueFn !== "function" && typeof keyFn !== "function") {
|
|
900
|
-
return value;
|
|
901
|
-
}
|
|
902
|
-
if (value.size < 1) {
|
|
903
|
-
return value;
|
|
904
|
-
}
|
|
905
|
-
const newOpt = this.$runOpt(opt);
|
|
906
|
-
const field = (typeof newOpt.field === 'string') ? newOpt.field : undefined;
|
|
907
|
-
const clonedOpt = Object.assign({}, newOpt);
|
|
908
|
-
const cloned = Object.fromEntries(value.entries());
|
|
909
|
-
let index = -1;
|
|
910
|
-
value.clear();
|
|
911
|
-
for (const [k, v] of Object.entries(cloned)) {
|
|
912
|
-
if (typeof k === 'symbol') {
|
|
913
|
-
continue;
|
|
914
|
-
}
|
|
915
|
-
index++;
|
|
916
|
-
let newKey = k;
|
|
917
|
-
let newValue = v;
|
|
918
|
-
if (typeof keyFn === 'function') {
|
|
919
|
-
clonedOpt.field = field ? `${field}#${index}` : `#${index}`;
|
|
920
|
-
try {
|
|
921
|
-
newKey = keyFn(k, index, clonedOpt);
|
|
922
|
-
}
|
|
923
|
-
catch (e) {
|
|
924
|
-
this.$errorOrLog(clonedOpt, undefined, e);
|
|
925
|
-
}
|
|
926
|
-
if (this._EMPTY.includes(newKey)) {
|
|
927
|
-
continue;
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
if (typeof valueFn === 'function') {
|
|
931
|
-
clonedOpt.field = field ? `${field}.${k}` : k;
|
|
932
|
-
try {
|
|
933
|
-
newValue = valueFn(v, k, clonedOpt);
|
|
934
|
-
}
|
|
935
|
-
catch (e) {
|
|
936
|
-
this.$errorOrLog(clonedOpt, undefined, e);
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
value.set(newKey, newValue);
|
|
940
|
-
}
|
|
941
|
-
return value;
|
|
942
|
-
}
|
|
943
|
-
else if (Array.isArray(value)) {
|
|
944
|
-
if (value.length === 1) {
|
|
945
|
-
return this.map(value[0], opt, valueFn, keyFn, notNull);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
else if (this.lyy.is.bareObject(value)) {
|
|
949
|
-
const newMap = new Map();
|
|
950
|
-
const keys = Object.keys(value);
|
|
951
|
-
if (keys.length < 1) {
|
|
952
|
-
return newMap;
|
|
953
|
-
}
|
|
954
|
-
for (const [k, v] of Object.entries(value)) {
|
|
955
|
-
newMap.set(k, v);
|
|
956
|
-
}
|
|
957
|
-
return this.map(newMap, opt, valueFn, keyFn, notNull);
|
|
958
|
-
}
|
|
959
|
-
break;
|
|
960
|
-
case 'function':
|
|
961
|
-
return this.$runFn(v => this.map(v, opt, valueFn, keyFn, notNull), value, opt);
|
|
962
|
-
}
|
|
963
|
-
return this.$unexpectedError(value, this._EXPECTED_OBJECT, opt);
|
|
964
|
-
}
|
|
965
|
-
dictStrict(value, opt, valueFn, keyFn) {
|
|
966
|
-
return this.dict(value, opt, valueFn, keyFn, true);
|
|
967
|
-
}
|
|
968
|
-
dictStrictNotEmpty(value, opt, valueFn, keyFn) {
|
|
969
|
-
const result = this.dict(value, opt, valueFn, keyFn, true);
|
|
970
|
-
if (Object.keys(result).length < 1) {
|
|
971
|
-
this.$emptyError('dict', opt);
|
|
972
|
-
}
|
|
973
|
-
return result;
|
|
974
|
-
}
|
|
975
|
-
dictNotEmpty(value, opt, valueFn, keyFn, notNull) {
|
|
976
|
-
const result = this.dict(value, opt, valueFn, keyFn, false);
|
|
977
|
-
if (result && Object.keys(result).length < 1) {
|
|
978
|
-
this.$emptyError('dict', opt);
|
|
979
|
-
}
|
|
980
|
-
return result;
|
|
981
|
-
}
|
|
982
|
-
dict(value, opt, valueFn, keyFn, notNull) {
|
|
983
|
-
if (this._EMPTY.includes(value)) {
|
|
984
|
-
if (notNull) {
|
|
985
|
-
this.$nullError(this._EXPECTED_OBJECT, opt);
|
|
986
|
-
}
|
|
987
|
-
return value;
|
|
988
|
-
}
|
|
989
|
-
switch (typeof value) {
|
|
990
|
-
case 'object':
|
|
991
|
-
if (value instanceof Set) {
|
|
992
|
-
if (value.size === 1) {
|
|
993
|
-
return this.dict(Array.from(value.values())[0], opt, valueFn, keyFn, notNull);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
else if (value instanceof list_1.List) {
|
|
997
|
-
if (value.length === 1) {
|
|
998
|
-
return this.dict(value[0], opt, valueFn, keyFn, notNull);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
else if (value instanceof Map) {
|
|
1002
|
-
if (value.size < 1) {
|
|
1003
|
-
return {};
|
|
1004
|
-
}
|
|
1005
|
-
return this.dict(Object.fromEntries(value.entries()), opt, valueFn, keyFn, notNull);
|
|
1006
|
-
}
|
|
1007
|
-
else if (Array.isArray(value)) {
|
|
1008
|
-
if (value.length === 1) {
|
|
1009
|
-
return this.dict(value[0], opt, valueFn, keyFn, notNull);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
else if (this.lyy.is.bareObject(value)) {
|
|
1013
|
-
if (typeof valueFn !== "function" && typeof keyFn !== "function") {
|
|
1014
|
-
return value;
|
|
1015
|
-
}
|
|
1016
|
-
const keys = Object.keys(value);
|
|
1017
|
-
if (keys.length < 1) {
|
|
1018
|
-
return value;
|
|
1019
|
-
}
|
|
1020
|
-
const newOpt = this.$runOpt(opt);
|
|
1021
|
-
const field = (typeof newOpt.field === 'string') ? newOpt.field : undefined;
|
|
1022
|
-
const clonedOpt = Object.assign({}, newOpt);
|
|
1023
|
-
const cloned = Object.assign({}, value);
|
|
1024
|
-
keys
|
|
1025
|
-
.filter(k => typeof k !== 'symbol')
|
|
1026
|
-
.forEach(k => {
|
|
1027
|
-
try {
|
|
1028
|
-
delete value[k];
|
|
1029
|
-
}
|
|
1030
|
-
catch (e) {
|
|
1031
|
-
}
|
|
1032
|
-
});
|
|
1033
|
-
let index = -1;
|
|
1034
|
-
for (const [k, v] of Object.entries(cloned)) {
|
|
1035
|
-
if (typeof k === 'symbol') {
|
|
1036
|
-
continue;
|
|
1037
|
-
}
|
|
1038
|
-
index++;
|
|
1039
|
-
let newKey = k;
|
|
1040
|
-
let newValue = v;
|
|
1041
|
-
if (typeof keyFn === 'function') {
|
|
1042
|
-
clonedOpt.field = field ? `${field}#${index}` : `#${index}`;
|
|
1043
|
-
try {
|
|
1044
|
-
newKey = keyFn(k, index, clonedOpt);
|
|
1045
|
-
}
|
|
1046
|
-
catch (e) {
|
|
1047
|
-
this.$errorOrLog(clonedOpt, undefined, e);
|
|
1048
|
-
}
|
|
1049
|
-
if (this._EMPTY.includes(newKey)) {
|
|
1050
|
-
continue;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
if (typeof valueFn === 'function') {
|
|
1054
|
-
clonedOpt.field = field ? `${field}.${k}` : k;
|
|
1055
|
-
try {
|
|
1056
|
-
newValue = valueFn(v, k, clonedOpt);
|
|
1057
|
-
}
|
|
1058
|
-
catch (e) {
|
|
1059
|
-
this.$errorOrLog(clonedOpt, undefined, e);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
try {
|
|
1063
|
-
value[newKey] = newValue;
|
|
1064
|
-
}
|
|
1065
|
-
catch (e) {
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
return value;
|
|
1069
|
-
}
|
|
1070
|
-
// other objects, don't toch
|
|
1071
|
-
return value;
|
|
1072
|
-
case 'function':
|
|
1073
|
-
return this.$runFn(v => this.dict(v, opt, valueFn, keyFn, notNull), value, opt);
|
|
1074
|
-
}
|
|
1075
|
-
return this.$unexpectedError(value, this._EXPECTED_OBJECT, opt);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
exports.ToCommon = ToCommon;
|
|
1079
|
-
//# sourceMappingURL=to.common.js.map
|