@leyyo/common 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/index.d.ts +3 -3
- package/dist/base/index.js +3 -20
- package/dist/base/index.types.d.ts +32 -18
- package/dist/base/index.types.js +1 -3
- package/dist/base/leyyo.d.ts +1 -1
- package/dist/base/leyyo.js +35 -26
- package/dist/base/leyyo.types.d.ts +3 -3
- package/dist/base/leyyo.types.js +1 -3
- package/dist/class/index.d.ts +2 -2
- package/dist/class/index.js +2 -19
- package/dist/class/index.types.d.ts +1 -1
- package/dist/class/index.types.js +1 -3
- package/dist/class/list.d.ts +1 -1
- package/dist/class/list.js +1 -6
- package/dist/class/logger.instance.d.ts +5 -5
- package/dist/class/logger.instance.js +8 -12
- package/dist/common/deploy.common.d.ts +2 -2
- package/dist/common/deploy.common.js +14 -16
- package/dist/common/enum.pool.d.ts +5 -3
- package/dist/common/enum.pool.js +36 -48
- package/dist/common/error.common.d.ts +4 -4
- package/dist/common/error.common.js +45 -85
- package/dist/common/error.pool.d.ts +5 -3
- package/dist/common/error.pool.js +12 -23
- package/dist/common/event.common.d.ts +2 -2
- package/dist/common/event.common.js +25 -28
- package/dist/common/index.d.ts +11 -11
- package/dist/common/index.js +11 -28
- package/dist/common/index.types.d.ts +42 -6
- package/dist/common/index.types.js +1 -3
- package/dist/common/inert.d.ts +4 -2
- package/dist/common/inert.js +97 -110
- package/dist/common/lifecycle.common.d.ts +2 -2
- package/dist/common/lifecycle.common.js +48 -61
- package/dist/common/literal.pool.d.ts +6 -3
- package/dist/common/literal.pool.js +37 -48
- package/dist/common/log.common.d.ts +4 -4
- package/dist/common/log.common.js +63 -60
- package/dist/common/repo.common.d.ts +3 -3
- package/dist/common/repo.common.js +50 -52
- package/dist/const/index.js +26 -30
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -18
- package/dist/enum/log-level.js +1 -5
- package/dist/error/caused.error.d.ts +2 -2
- package/dist/error/caused.error.js +2 -7
- package/dist/error/developer.error.d.ts +3 -3
- package/dist/error/developer.error.js +9 -9
- package/dist/error/http.error.d.ts +2 -2
- package/dist/error/http.error.js +9 -15
- package/dist/error/index.d.ts +7 -7
- package/dist/error/index.js +7 -24
- package/dist/error/index.types.d.ts +3 -3
- package/dist/error/index.types.js +1 -3
- package/dist/error/invalid-value.error.d.ts +1 -1
- package/dist/error/invalid-value.error.js +6 -13
- package/dist/error/leyyo.error.d.ts +5 -5
- package/dist/error/leyyo.error.js +45 -34
- package/dist/error/multiple.error.d.ts +2 -2
- package/dist/error/multiple.error.js +6 -12
- package/dist/function/define-loader.d.ts +1 -1
- package/dist/function/define-loader.js +7 -10
- package/dist/function/delay.js +2 -6
- package/dist/function/delete-prop.js +9 -15
- package/dist/function/{empty.fn.js → empty-fn.js} +1 -5
- package/dist/function/extended-type.d.ts +1 -1
- package/dist/function/extended-type.js +8 -12
- package/dist/function/get-fqn.d.ts +1 -1
- package/dist/function/get-fqn.js +7 -12
- package/dist/function/get-prop.js +10 -16
- package/dist/function/has-fqn.d.ts +1 -1
- package/dist/function/has-fqn.js +7 -11
- package/dist/function/index.d.ts +38 -28
- package/dist/function/index.js +38 -45
- package/dist/function/index.types.d.ts +2 -2
- package/dist/function/index.types.js +1 -3
- package/dist/function/is-anonymous-name.js +3 -7
- package/dist/function/is-class.d.ts +7 -0
- package/dist/function/is-class.js +18 -0
- package/dist/function/is-empty.d.ts +12 -0
- package/dist/function/is-empty.js +18 -0
- package/dist/function/is-filled-arr.d.ts +10 -0
- package/dist/function/is-filled-arr.js +12 -0
- package/dist/function/is-filled-obj.d.ts +10 -0
- package/dist/function/is-filled-obj.js +13 -0
- package/dist/function/is-obj.d.ts +9 -0
- package/dist/function/is-obj.js +11 -0
- package/dist/function/is-test.js +2 -7
- package/dist/function/is-text.d.ts +11 -0
- package/dist/function/is-text.js +17 -0
- package/dist/function/jitter-interval.js +2 -6
- package/dist/function/leyyo-fn.d.ts +1 -1
- package/dist/function/leyyo-fn.js +2 -7
- package/dist/function/on-fqn-set.d.ts +1 -1
- package/dist/function/on-fqn-set.js +9 -13
- package/dist/function/one-or-more.d.ts +1 -1
- package/dist/function/one-or-more.js +1 -5
- package/dist/function/opt-add.d.ts +10 -0
- package/dist/function/opt-add.js +29 -0
- package/dist/function/opt-append.d.ts +9 -0
- package/dist/function/opt-append.js +24 -0
- package/dist/function/opt-check.d.ts +8 -0
- package/dist/function/opt-check.js +31 -0
- package/dist/function/opt-clone.d.ts +8 -0
- package/dist/function/opt-clone.js +12 -0
- package/dist/function/opt-field.d.ts +11 -0
- package/dist/function/opt-field.js +31 -0
- package/dist/function/opt-fn.d.ts +8 -0
- package/dist/function/opt-fn.js +11 -0
- package/dist/function/random-test-no.js +1 -5
- package/dist/function/remove-fqn.d.ts +1 -1
- package/dist/function/remove-fqn.js +10 -14
- package/dist/function/run-exporter.d.ts +1 -1
- package/dist/function/run-exporter.js +12 -27
- package/dist/function/secure-clone.d.ts +1 -1
- package/dist/function/secure-clone.js +2 -7
- package/dist/function/secure-json.js +6 -12
- package/dist/function/set-anonymous-fqn.d.ts +1 -1
- package/dist/function/set-anonymous-fqn.js +15 -19
- package/dist/function/set-anonymous-name.d.ts +1 -1
- package/dist/function/set-anonymous-name.js +23 -26
- package/dist/function/set-fqn.d.ts +1 -1
- package/dist/function/set-fqn.js +28 -31
- package/dist/function/set-prop.js +9 -15
- package/dist/function/stamp-loader.d.ts +1 -1
- package/dist/function/stamp-loader.js +4 -8
- package/dist/function/test-case.js +5 -9
- package/dist/function/test-name.js +4 -8
- package/dist/function/trigger-fqn.d.ts +1 -1
- package/dist/function/trigger-fqn.js +5 -9
- package/dist/index.d.ts +19 -19
- package/dist/index.foretell.js +10 -88
- package/dist/index.js +22 -40
- package/dist/index.loader.d.ts +1 -1
- package/dist/index.loader.js +6 -43
- package/dist/init/index.js +3 -7
- package/dist/internal.js +1 -5
- package/package.json +26 -16
- package/dist/assets/.gitkeep +0 -0
- package/dist/base/index.js.map +0 -1
- package/dist/base/index.types.js.map +0 -1
- package/dist/base/leyyo.js.map +0 -1
- package/dist/base/leyyo.types.js.map +0 -1
- package/dist/class/index.js.map +0 -1
- package/dist/class/index.types.js.map +0 -1
- package/dist/class/list.js.map +0 -1
- package/dist/class/logger.instance.js.map +0 -1
- package/dist/common/deploy.common.js.map +0 -1
- package/dist/common/enum.pool.js.map +0 -1
- package/dist/common/error.common.js.map +0 -1
- package/dist/common/error.pool.js.map +0 -1
- package/dist/common/event.common.js.map +0 -1
- package/dist/common/index.js.map +0 -1
- package/dist/common/index.types.js.map +0 -1
- package/dist/common/inert.js.map +0 -1
- package/dist/common/lifecycle.common.js.map +0 -1
- package/dist/common/literal.pool.js.map +0 -1
- package/dist/common/log.common.js.map +0 -1
- package/dist/common/repo.common.js.map +0 -1
- package/dist/const/index.js.map +0 -1
- package/dist/enum/index.js.map +0 -1
- package/dist/enum/log-level.js.map +0 -1
- package/dist/error/caused.error.js.map +0 -1
- package/dist/error/developer.error.js.map +0 -1
- package/dist/error/http.error.js.map +0 -1
- package/dist/error/index.js.map +0 -1
- package/dist/error/index.types.js.map +0 -1
- package/dist/error/invalid-value.error.js.map +0 -1
- package/dist/error/leyyo.error.js.map +0 -1
- package/dist/error/multiple.error.js.map +0 -1
- package/dist/function/define-loader.js.map +0 -1
- package/dist/function/delay.js.map +0 -1
- package/dist/function/delete-prop.js.map +0 -1
- package/dist/function/empty.fn.js.map +0 -1
- package/dist/function/extended-type.js.map +0 -1
- package/dist/function/get-fqn.js.map +0 -1
- package/dist/function/get-prop.js.map +0 -1
- package/dist/function/has-fqn.js.map +0 -1
- package/dist/function/index.js.map +0 -1
- package/dist/function/index.types.js.map +0 -1
- package/dist/function/is-anonymous-name.js.map +0 -1
- package/dist/function/is-test.js.map +0 -1
- package/dist/function/is.fn.d.ts +0 -59
- package/dist/function/is.fn.js +0 -93
- package/dist/function/is.fn.js.map +0 -1
- package/dist/function/jitter-interval.js.map +0 -1
- package/dist/function/leyyo-fn.js.map +0 -1
- package/dist/function/on-fqn-set.js.map +0 -1
- package/dist/function/one-or-more.js.map +0 -1
- package/dist/function/opt.fn.d.ts +0 -49
- package/dist/function/opt.fn.js +0 -142
- package/dist/function/opt.fn.js.map +0 -1
- package/dist/function/random-test-no.js.map +0 -1
- package/dist/function/remove-fqn.js.map +0 -1
- package/dist/function/run-exporter.js.map +0 -1
- package/dist/function/secure-clone.js.map +0 -1
- package/dist/function/secure-json.js.map +0 -1
- package/dist/function/set-anonymous-fqn.js.map +0 -1
- package/dist/function/set-anonymous-name.js.map +0 -1
- package/dist/function/set-fqn.js.map +0 -1
- package/dist/function/set-prop.js.map +0 -1
- package/dist/function/stamp-loader.js.map +0 -1
- package/dist/function/test-case.js.map +0 -1
- package/dist/function/test-name.js.map +0 -1
- package/dist/function/trigger-fqn.js.map +0 -1
- package/dist/index.foretell.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.loader.js.map +0 -1
- package/dist/init/index.js.map +0 -1
- package/dist/internal.js.map +0 -1
- /package/dist/function/{empty.fn.d.ts → empty-fn.d.ts} +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const class_1 = require("../class");
|
|
5
|
-
const const_1 = require("../const");
|
|
6
|
-
const is_fn_1 = require("./is.fn");
|
|
1
|
+
import { List } from "../class/list.js";
|
|
2
|
+
import { KEY_ENUM_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
3
|
+
import { isClass } from "./is-class.js";
|
|
7
4
|
// noinspection JSUnusedGlobalSymbols
|
|
8
5
|
/**
|
|
9
6
|
* Get extended type of value
|
|
@@ -11,7 +8,7 @@ const is_fn_1 = require("./is.fn");
|
|
|
11
8
|
* @param {any} value - given value
|
|
12
9
|
* @return {ExtendedType}
|
|
13
10
|
* */
|
|
14
|
-
function extendedType(value) {
|
|
11
|
+
export function extendedType(value) {
|
|
15
12
|
switch (typeof value) {
|
|
16
13
|
case "string":
|
|
17
14
|
const trimmed = value.trim();
|
|
@@ -32,10 +29,10 @@ function extendedType(value) {
|
|
|
32
29
|
return 'null';
|
|
33
30
|
}
|
|
34
31
|
if (Array.isArray(value)) {
|
|
35
|
-
if (value[
|
|
32
|
+
if (value[KEY_LITERAL_NAME]) {
|
|
36
33
|
return 'literal-items';
|
|
37
34
|
}
|
|
38
|
-
return (value instanceof
|
|
35
|
+
return (value instanceof List) ? 'list' : 'array';
|
|
39
36
|
}
|
|
40
37
|
if (value instanceof Date) {
|
|
41
38
|
return 'date';
|
|
@@ -46,14 +43,13 @@ function extendedType(value) {
|
|
|
46
43
|
if (value instanceof Set) {
|
|
47
44
|
return 'set';
|
|
48
45
|
}
|
|
49
|
-
if (value[
|
|
46
|
+
if (value[KEY_ENUM_NAME]) {
|
|
50
47
|
return 'enum-map';
|
|
51
48
|
}
|
|
52
49
|
return 'object';
|
|
53
50
|
case "function":
|
|
54
|
-
return
|
|
51
|
+
return isClass(value) ? 'class' : 'function';
|
|
55
52
|
default:
|
|
56
53
|
return typeof value;
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
//# sourceMappingURL=extended-type.js.map
|
package/dist/function/get-fqn.js
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFqn = getFqn;
|
|
4
|
-
const const_1 = require("../const");
|
|
1
|
+
import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
5
2
|
/**
|
|
6
3
|
* Get fqn name
|
|
7
4
|
*
|
|
8
5
|
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
9
6
|
* @return {string} - fully qualified name
|
|
10
7
|
* */
|
|
11
|
-
function getFqn(target) {
|
|
12
|
-
var _a, _b, _c;
|
|
8
|
+
export function getFqn(target) {
|
|
13
9
|
if (!target) {
|
|
14
10
|
return undefined;
|
|
15
11
|
}
|
|
16
12
|
if (typeof target === 'function') { // function, class
|
|
17
|
-
return
|
|
13
|
+
return target[KEY_FQN_NAME] ?? target.name;
|
|
18
14
|
}
|
|
19
15
|
else if (typeof target === 'object') {
|
|
20
16
|
if (Array.isArray(target)) {
|
|
21
|
-
if (target[
|
|
22
|
-
return
|
|
17
|
+
if (target[KEY_LITERAL_NAME]) {
|
|
18
|
+
return target[KEY_FQN_NAME] ?? target[KEY_LITERAL_NAME];
|
|
23
19
|
}
|
|
24
20
|
return undefined;
|
|
25
21
|
}
|
|
26
|
-
if (target[
|
|
27
|
-
return
|
|
22
|
+
if (target[KEY_ENUM_NAME]) {
|
|
23
|
+
return target[KEY_FQN_NAME] ?? target[KEY_ENUM_NAME];
|
|
28
24
|
}
|
|
29
25
|
return target.constructor !== Object ? getFqn(target.constructor) : undefined;
|
|
30
26
|
}
|
|
31
27
|
return undefined;
|
|
32
28
|
}
|
|
33
|
-
//# sourceMappingURL=get-fqn.js.map
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.getProp = getProp;
|
|
6
|
-
const internal_1 = require("../internal");
|
|
7
|
-
const test_case_1 = require("./test-case");
|
|
8
|
-
const leyyo_fn_1 = require("./leyyo-fn");
|
|
9
|
-
const where = `${internal_1.FQN}.GetProp`;
|
|
1
|
+
import { FQN } from "../internal.js";
|
|
2
|
+
import { testCase } from "./test-case.js";
|
|
3
|
+
import { $$get_leyyo_fn } from "./leyyo-fn.js";
|
|
4
|
+
const where = `${FQN}.GetProp`;
|
|
10
5
|
let _leyyo;
|
|
11
6
|
/**
|
|
12
7
|
* Get target property
|
|
@@ -15,7 +10,7 @@ let _leyyo;
|
|
|
15
10
|
* @param {string} key - key
|
|
16
11
|
* @return {any}
|
|
17
12
|
* */
|
|
18
|
-
function getKey(target, key) {
|
|
13
|
+
export function getKey(target, key) {
|
|
19
14
|
if (typeof key !== 'string') {
|
|
20
15
|
return undefined;
|
|
21
16
|
}
|
|
@@ -28,7 +23,7 @@ function getKey(target, key) {
|
|
|
28
23
|
* @param {symbol} key - hidden key
|
|
29
24
|
* @return {any}
|
|
30
25
|
* */
|
|
31
|
-
function getSymbol(target, key) {
|
|
26
|
+
export function getSymbol(target, key) {
|
|
32
27
|
if (typeof key !== 'symbol') {
|
|
33
28
|
return undefined;
|
|
34
29
|
}
|
|
@@ -41,7 +36,7 @@ function getSymbol(target, key) {
|
|
|
41
36
|
* @param {(symbol|string)} key - key
|
|
42
37
|
* @return {any}
|
|
43
38
|
* */
|
|
44
|
-
function getProp(target, key) {
|
|
39
|
+
export function getProp(target, key) {
|
|
45
40
|
if (!['symbol', 'string'].includes(typeof key)) {
|
|
46
41
|
return undefined;
|
|
47
42
|
}
|
|
@@ -50,14 +45,13 @@ function getProp(target, key) {
|
|
|
50
45
|
}
|
|
51
46
|
try {
|
|
52
47
|
const prop = Object.getOwnPropertyDescriptor(target, key);
|
|
53
|
-
return prop
|
|
48
|
+
return prop?.value;
|
|
54
49
|
}
|
|
55
50
|
catch (e) {
|
|
56
51
|
if (!_leyyo) {
|
|
57
|
-
_leyyo =
|
|
52
|
+
_leyyo = $$get_leyyo_fn();
|
|
58
53
|
}
|
|
59
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`,
|
|
54
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, 'ZZZ'), where).log(e);
|
|
60
55
|
return undefined;
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
|
-
//# sourceMappingURL=get-prop.js.map
|
package/dist/function/has-fqn.js
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasFqn = hasFqn;
|
|
4
|
-
const const_1 = require("../const");
|
|
1
|
+
import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
5
2
|
/**
|
|
6
3
|
* Get fqn name
|
|
7
4
|
*
|
|
8
5
|
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
9
6
|
* @return {string} - fully qualified name
|
|
10
7
|
* */
|
|
11
|
-
function hasFqn(target) {
|
|
8
|
+
export function hasFqn(target) {
|
|
12
9
|
if (!target) {
|
|
13
10
|
return false;
|
|
14
11
|
}
|
|
15
12
|
if (typeof target === 'function') { // function, class
|
|
16
|
-
return !!target[
|
|
13
|
+
return !!target[KEY_FQN_NAME];
|
|
17
14
|
}
|
|
18
15
|
else if (typeof target === 'object') {
|
|
19
16
|
if (Array.isArray(target)) {
|
|
20
|
-
if (target[
|
|
21
|
-
return !!target[
|
|
17
|
+
if (target[KEY_LITERAL_NAME]) {
|
|
18
|
+
return !!target[KEY_FQN_NAME];
|
|
22
19
|
}
|
|
23
20
|
return false;
|
|
24
21
|
}
|
|
25
|
-
if (target[
|
|
26
|
-
return !!target[
|
|
22
|
+
if (target[KEY_ENUM_NAME]) {
|
|
23
|
+
return !!target[KEY_FQN_NAME];
|
|
27
24
|
}
|
|
28
25
|
return target.constructor !== Object ? hasFqn(target.constructor) : false;
|
|
29
26
|
}
|
|
30
27
|
return false;
|
|
31
28
|
}
|
|
32
|
-
//# sourceMappingURL=has-fqn.js.map
|
package/dist/function/index.d.ts
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './delay';
|
|
3
|
-
export * from './delete-prop';
|
|
4
|
-
export * from './empty.
|
|
5
|
-
export * from './extended-type';
|
|
6
|
-
export * from './get-fqn';
|
|
7
|
-
export * from './set-fqn';
|
|
8
|
-
export * from './remove-fqn';
|
|
9
|
-
export * from './on-fqn-set';
|
|
10
|
-
export * from './set-anonymous-fqn';
|
|
11
|
-
export * from './get-prop';
|
|
12
|
-
export * from './has-fqn';
|
|
13
|
-
export * from './is.
|
|
14
|
-
export * from './is-
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './
|
|
28
|
-
export * from './
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './delay.js';
|
|
3
|
+
export * from './delete-prop.js';
|
|
4
|
+
export * from './empty-fn.js';
|
|
5
|
+
export * from './extended-type.js';
|
|
6
|
+
export * from './get-fqn.js';
|
|
7
|
+
export * from './set-fqn.js';
|
|
8
|
+
export * from './remove-fqn.js';
|
|
9
|
+
export * from './on-fqn-set.js';
|
|
10
|
+
export * from './set-anonymous-fqn.js';
|
|
11
|
+
export * from './get-prop.js';
|
|
12
|
+
export * from './has-fqn.js';
|
|
13
|
+
export * from './is-class.js';
|
|
14
|
+
export * from './is-empty.js';
|
|
15
|
+
export * from './is-filled-arr.js';
|
|
16
|
+
export * from './is-filled-obj.js';
|
|
17
|
+
export * from './is-obj.js';
|
|
18
|
+
export * from './is-text.js';
|
|
19
|
+
export * from './is-anonymous-name.js';
|
|
20
|
+
export * from './jitter-interval.js';
|
|
21
|
+
export * from './define-loader.js';
|
|
22
|
+
export * from './stamp-loader.js';
|
|
23
|
+
export * from './one-or-more.js';
|
|
24
|
+
export * from './opt-add.js';
|
|
25
|
+
export * from './opt-append.js';
|
|
26
|
+
export * from './opt-check.js';
|
|
27
|
+
export * from './opt-clone.js';
|
|
28
|
+
export * from './opt-field.js';
|
|
29
|
+
export * from './opt-fn.js';
|
|
30
|
+
export * from './run-exporter.js';
|
|
31
|
+
export * from './secure-clone.js';
|
|
32
|
+
export * from './secure-json.js';
|
|
33
|
+
export * from './set-anonymous-name.js';
|
|
34
|
+
export * from './set-prop.js';
|
|
35
|
+
export * from './test-case.js';
|
|
36
|
+
export * from './test-name.js';
|
|
37
|
+
export * from './random-test-no.js';
|
|
38
|
+
export * from './is-test.js';
|
package/dist/function/index.js
CHANGED
|
@@ -1,45 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
__exportStar(require("./set-anonymous-name"), exports);
|
|
40
|
-
__exportStar(require("./set-prop"), exports);
|
|
41
|
-
__exportStar(require("./test-case"), exports);
|
|
42
|
-
__exportStar(require("./test-name"), exports);
|
|
43
|
-
__exportStar(require("./random-test-no"), exports);
|
|
44
|
-
__exportStar(require("./is-test"), exports);
|
|
45
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './delay.js';
|
|
3
|
+
export * from './delete-prop.js';
|
|
4
|
+
export * from './empty-fn.js';
|
|
5
|
+
export * from './extended-type.js';
|
|
6
|
+
export * from './get-fqn.js';
|
|
7
|
+
export * from './set-fqn.js';
|
|
8
|
+
export * from './remove-fqn.js';
|
|
9
|
+
export * from './on-fqn-set.js';
|
|
10
|
+
export * from './set-anonymous-fqn.js';
|
|
11
|
+
export * from './get-prop.js';
|
|
12
|
+
export * from './has-fqn.js';
|
|
13
|
+
export * from './is-class.js';
|
|
14
|
+
export * from './is-empty.js';
|
|
15
|
+
export * from './is-filled-arr.js';
|
|
16
|
+
export * from './is-filled-obj.js';
|
|
17
|
+
export * from './is-obj.js';
|
|
18
|
+
export * from './is-text.js';
|
|
19
|
+
export * from './is-anonymous-name.js';
|
|
20
|
+
export * from './jitter-interval.js';
|
|
21
|
+
export * from './define-loader.js';
|
|
22
|
+
export * from './stamp-loader.js';
|
|
23
|
+
export * from './one-or-more.js';
|
|
24
|
+
export * from './opt-add.js';
|
|
25
|
+
export * from './opt-append.js';
|
|
26
|
+
export * from './opt-check.js';
|
|
27
|
+
export * from './opt-clone.js';
|
|
28
|
+
export * from './opt-field.js';
|
|
29
|
+
export * from './opt-fn.js';
|
|
30
|
+
export * from './run-exporter.js';
|
|
31
|
+
export * from './secure-clone.js';
|
|
32
|
+
export * from './secure-json.js';
|
|
33
|
+
export * from './set-anonymous-name.js';
|
|
34
|
+
export * from './set-prop.js';
|
|
35
|
+
export * from './test-case.js';
|
|
36
|
+
export * from './test-name.js';
|
|
37
|
+
export * from './random-test-no.js';
|
|
38
|
+
export * from './is-test.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClassLike, Describable, ExtendedType, Fnc, Obj, OneOrMore, SetOrMore } from "../base";
|
|
2
|
-
import { Enum, Literal } from "../common";
|
|
1
|
+
import { ClassLike, Describable, ExtendedType, Fnc, Obj, OneOrMore, SetOrMore } from "../base/index.js";
|
|
2
|
+
import { Enum, Literal } from "../common/index.js";
|
|
3
3
|
export type FqnTarget = ClassLike | Fnc | Obj | Enum | Literal;
|
|
4
4
|
export type FqnOnSetLambda = (full: string) => void;
|
|
5
5
|
export type LoaderLike = Array<LoaderItem>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isAnonymousName = isAnonymousName;
|
|
4
|
-
const const_1 = require("../const");
|
|
5
|
-
function isAnonymousName(name) {
|
|
1
|
+
import { VAL_NAME_ANONYMOUS } from "../const/index.js";
|
|
2
|
+
export function isAnonymousName(name) {
|
|
6
3
|
if (typeof name === 'string') {
|
|
7
|
-
return name.trim().startsWith(
|
|
4
|
+
return name.trim().startsWith(VAL_NAME_ANONYMOUS);
|
|
8
5
|
}
|
|
9
6
|
return false;
|
|
10
7
|
}
|
|
11
|
-
//# sourceMappingURL=is-anonymous-name.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is class?
|
|
3
|
+
*
|
|
4
|
+
* @param {any} fn - given value
|
|
5
|
+
* @return {boolean} - is class?
|
|
6
|
+
* */
|
|
7
|
+
export function isClass(fn) {
|
|
8
|
+
// Class constructor is also a function
|
|
9
|
+
if (!(fn && fn.constructor === Function) || fn.prototype === undefined) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
// This is a class that extends other class
|
|
13
|
+
if (Function.prototype !== Object.getPrototypeOf(fn)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// Usually a function will only have 'constructor' in the prototype
|
|
17
|
+
return Object.getOwnPropertyNames(fn.prototype).length > 1;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is empty?
|
|
3
|
+
* Means:
|
|
4
|
+
* - `not null`
|
|
5
|
+
* - `not undefined`
|
|
6
|
+
* - `not empty string`
|
|
7
|
+
*
|
|
8
|
+
* @param {any} value - given value
|
|
9
|
+
* @param {boolean?} notSpace - yes: ignore empty string
|
|
10
|
+
* @return {boolean} - is empty?
|
|
11
|
+
* */
|
|
12
|
+
export declare function isEmpty(value: unknown, notSpace?: boolean): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EMPTY_VALUES } from "../const/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Is empty?
|
|
4
|
+
* Means:
|
|
5
|
+
* - `not null`
|
|
6
|
+
* - `not undefined`
|
|
7
|
+
* - `not empty string`
|
|
8
|
+
*
|
|
9
|
+
* @param {any} value - given value
|
|
10
|
+
* @param {boolean?} notSpace - yes: ignore empty string
|
|
11
|
+
* @return {boolean} - is empty?
|
|
12
|
+
* */
|
|
13
|
+
export function isEmpty(value, notSpace) {
|
|
14
|
+
if (notSpace) {
|
|
15
|
+
return EMPTY_VALUES.includes(value);
|
|
16
|
+
}
|
|
17
|
+
return EMPTY_VALUES.includes(value) || (typeof value === 'string' && !value.trim());
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is filled array?
|
|
3
|
+
* Means
|
|
4
|
+
* - `constructor === "Array"`
|
|
5
|
+
* - `arr.length > 0`
|
|
6
|
+
*
|
|
7
|
+
* @param {any} arr - given value
|
|
8
|
+
* @return {boolean} - is filled array?
|
|
9
|
+
* */
|
|
10
|
+
export function isFilledArr(arr) {
|
|
11
|
+
return Array.isArray(arr) && arr.length > 0;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isObj } from "./is-obj.js";
|
|
2
|
+
/**
|
|
3
|
+
* Is filled object?
|
|
4
|
+
* Means:
|
|
5
|
+
* - `constructor === "Object"`
|
|
6
|
+
* - `obj.keys.length > 0`
|
|
7
|
+
*
|
|
8
|
+
* @param {any} obj - given value
|
|
9
|
+
* @return {boolean} - is filled object?
|
|
10
|
+
* */
|
|
11
|
+
export function isFilledObj(obj) {
|
|
12
|
+
return isObj(obj) && Object.keys(obj).length > 0;
|
|
13
|
+
}
|
package/dist/function/is-test.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.initTest = initTest;
|
|
5
|
-
exports.isTest = isTest;
|
|
6
2
|
// region properties
|
|
7
3
|
/**
|
|
8
4
|
* Is test?
|
|
@@ -12,7 +8,7 @@ let _isTest;
|
|
|
12
8
|
/**
|
|
13
9
|
* Initialize test
|
|
14
10
|
* */
|
|
15
|
-
function initTest() {
|
|
11
|
+
export function initTest() {
|
|
16
12
|
_isTest = true;
|
|
17
13
|
if (global) {
|
|
18
14
|
if (!global.leyyo_is_testing) {
|
|
@@ -31,7 +27,6 @@ function initTest() {
|
|
|
31
27
|
*
|
|
32
28
|
* @return {boolean}
|
|
33
29
|
* */
|
|
34
|
-
function isTest() {
|
|
30
|
+
export function isTest() {
|
|
35
31
|
return _isTest;
|
|
36
32
|
}
|
|
37
|
-
//# sourceMappingURL=is-test.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is text?
|
|
3
|
+
* Means:
|
|
4
|
+
* - `typeof === "string"`
|
|
5
|
+
* - `not empty string`
|
|
6
|
+
* - `not starts/ends with space`
|
|
7
|
+
*
|
|
8
|
+
* @param {any} str - given value
|
|
9
|
+
* @return {boolean} - is text?
|
|
10
|
+
* */
|
|
11
|
+
export function isText(str) {
|
|
12
|
+
if (typeof str !== 'string') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const val = str.trim();
|
|
16
|
+
return val && val === str;
|
|
17
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jitterInterval = jitterInterval;
|
|
4
1
|
// noinspection JSUnusedGlobalSymbols
|
|
5
2
|
/**
|
|
6
3
|
* Generate next delay time with exponential & randomized manner
|
|
@@ -11,14 +8,14 @@ exports.jitterInterval = jitterInterval;
|
|
|
11
8
|
* @param {number} maxTryCount - max try count, if `tryCount` excess it, it returns undefined
|
|
12
9
|
* @return {number} - next interval time if (maxTryCount && `tryCount` >= `maxTryCount`)
|
|
13
10
|
* */
|
|
14
|
-
function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
|
|
11
|
+
export function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
|
|
15
12
|
if ([tryCount, baseDelay, maxDelay].some(v => !isValid(v))) {
|
|
16
13
|
return undefined;
|
|
17
14
|
}
|
|
18
15
|
if (isValid(maxTryCount) && tryCount >= maxTryCount) {
|
|
19
16
|
return undefined;
|
|
20
17
|
}
|
|
21
|
-
const exp = Math.min(baseDelay *
|
|
18
|
+
const exp = Math.min(baseDelay * 2 ** tryCount, maxDelay);
|
|
22
19
|
const result = Math.floor(exp / 2 + Math.random() * (exp / 2));
|
|
23
20
|
return Number.isSafeInteger(result) ? result : undefined;
|
|
24
21
|
}
|
|
@@ -31,4 +28,3 @@ function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
|
|
|
31
28
|
function isValid(value) {
|
|
32
29
|
return typeof value === 'number' && value > 0 && Number.isInteger(value) && Number.isSafeInteger(value);
|
|
33
30
|
}
|
|
34
|
-
//# sourceMappingURL=jitter-interval.js.map
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$$set_leyyo_fn = $$set_leyyo_fn;
|
|
4
|
-
exports.$$get_leyyo_fn = $$get_leyyo_fn;
|
|
5
1
|
let _leyyo;
|
|
6
|
-
function $$set_leyyo_fn(leyyo) {
|
|
2
|
+
export function $$set_leyyo_fn(leyyo) {
|
|
7
3
|
if (!_leyyo && leyyo) {
|
|
8
4
|
_leyyo = leyyo;
|
|
9
5
|
}
|
|
10
6
|
}
|
|
11
|
-
function $$get_leyyo_fn() {
|
|
7
|
+
export function $$get_leyyo_fn() {
|
|
12
8
|
return _leyyo;
|
|
13
9
|
}
|
|
14
|
-
//# sourceMappingURL=leyyo-fn.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FqnOnSetLambda, FqnTarget } from "./index.types";
|
|
1
|
+
import { FqnOnSetLambda, FqnTarget } from "./index.types.js";
|
|
2
2
|
export declare function onFqnSet(target: FqnTarget, callback: FqnOnSetLambda): boolean;
|