@leyyo/common 1.3.17 → 1.3.19
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 -3
- package/dist/base/index.types.d.ts +3 -70
- package/dist/base/index.types.js +0 -32
- package/dist/base/leyyo.d.ts +0 -3
- package/dist/base/leyyo.js +12 -23
- package/dist/class/index.d.ts +2 -2
- package/dist/class/index.js +2 -2
- package/dist/class/index.types.d.ts +0 -20
- package/dist/class/list.d.ts +0 -6
- package/dist/class/list.js +0 -6
- package/dist/class/logger.instance.d.ts +8 -13
- package/dist/class/logger.instance.js +13 -27
- package/dist/common/deploy.common.d.ts +0 -16
- package/dist/common/deploy.common.js +4 -21
- package/dist/common/enum.pool.d.ts +5 -13
- package/dist/common/enum.pool.js +16 -17
- package/dist/common/error.common.d.ts +0 -30
- package/dist/common/error.common.js +33 -69
- package/dist/common/error.pool.d.ts +1 -10
- package/dist/common/error.pool.js +2 -13
- package/dist/common/event.common.d.ts +0 -8
- package/dist/common/event.common.js +15 -25
- package/dist/common/index.d.ts +11 -11
- package/dist/common/index.js +11 -11
- package/dist/common/index.types.d.ts +12 -435
- package/dist/common/index.types.js +0 -1
- package/dist/common/inert.d.ts +1 -49
- package/dist/common/inert.js +35 -64
- package/dist/common/lifecycle.common.d.ts +0 -14
- package/dist/common/lifecycle.common.js +13 -29
- package/dist/common/literal.pool.d.ts +1 -12
- package/dist/common/literal.pool.js +3 -18
- package/dist/common/log.common.d.ts +0 -54
- package/dist/common/log.common.js +62 -147
- package/dist/common/repo.common.d.ts +0 -188
- package/dist/common/repo.common.js +23 -239
- package/dist/const/index.d.ts +8 -12
- package/dist/const/index.js +28 -33
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -1
- package/dist/enum/log-level.d.ts +1 -4
- package/dist/enum/log-level.js +1 -1
- package/dist/error/caused.error.d.ts +0 -10
- package/dist/error/caused.error.js +0 -10
- package/dist/error/developer.error.d.ts +4 -17
- package/dist/error/developer.error.js +11 -33
- package/dist/error/http.error.d.ts +0 -13
- package/dist/error/http.error.js +1 -8
- package/dist/error/index.d.ts +7 -7
- package/dist/error/index.js +7 -7
- package/dist/error/index.types.d.ts +1 -150
- package/dist/error/invalid-value.error.d.ts +0 -3
- package/dist/error/invalid-value.error.js +1 -4
- package/dist/error/leyyo.error.d.ts +2 -35
- package/dist/error/leyyo.error.js +26 -58
- package/dist/error/multiple.error.d.ts +0 -6
- package/dist/error/multiple.error.js +2 -9
- package/dist/function/define-loader.d.ts +0 -6
- package/dist/function/define-loader.js +0 -6
- package/dist/function/delay.d.ts +0 -8
- package/dist/function/delay.js +0 -9
- package/dist/function/delete-prop.d.ts +0 -21
- package/dist/function/delete-prop.js +6 -28
- package/dist/function/empty-fn.d.ts +0 -6
- package/dist/function/empty-fn.js +1 -9
- package/dist/function/extended-type.d.ts +0 -6
- package/dist/function/extended-type.js +18 -24
- package/dist/function/get-fqn.d.ts +0 -6
- package/dist/function/get-fqn.js +2 -8
- package/dist/function/get-prop.d.ts +0 -21
- package/dist/function/get-prop.js +5 -26
- package/dist/function/get-stat.d.ts +0 -20
- package/dist/function/get-stat.js +7 -2
- package/dist/function/has-fqn.d.ts +0 -6
- package/dist/function/has-fqn.js +2 -8
- package/dist/function/index.d.ts +40 -40
- package/dist/function/index.js +40 -40
- package/dist/function/index.types.d.ts +1 -1
- package/dist/function/is-anonymous-name.js +1 -1
- package/dist/function/is-class.d.ts +0 -6
- package/dist/function/is-class.js +2 -20
- package/dist/function/is-empty.d.ts +0 -11
- package/dist/function/is-empty.js +1 -12
- package/dist/function/is-filled-arr.d.ts +0 -9
- package/dist/function/is-filled-arr.js +0 -9
- package/dist/function/is-filled-obj.d.ts +0 -9
- package/dist/function/is-filled-obj.js +0 -9
- package/dist/function/is-obj.d.ts +0 -8
- package/dist/function/is-obj.js +1 -9
- package/dist/function/is-test.d.ts +0 -8
- package/dist/function/is-test.js +3 -19
- package/dist/function/is-text.d.ts +0 -10
- package/dist/function/is-text.js +1 -11
- package/dist/function/jitter-interval.d.ts +0 -9
- package/dist/function/jitter-interval.js +2 -18
- package/dist/function/load-config.d.ts +0 -19
- package/dist/function/load-config.js +10 -61
- package/dist/function/on-fqn-set.js +3 -3
- package/dist/function/one-or-more.d.ts +0 -6
- package/dist/function/one-or-more.js +0 -7
- package/dist/function/opt-add.d.ts +0 -8
- package/dist/function/opt-add.js +2 -10
- package/dist/function/opt-append.d.ts +0 -7
- package/dist/function/opt-append.js +0 -7
- package/dist/function/opt-check.d.ts +0 -6
- package/dist/function/opt-check.js +2 -9
- package/dist/function/opt-clone.d.ts +0 -6
- package/dist/function/opt-clone.js +0 -7
- package/dist/function/opt-field.d.ts +0 -8
- package/dist/function/opt-field.js +6 -14
- package/dist/function/opt-fn.d.ts +0 -6
- package/dist/function/opt-fn.js +0 -7
- package/dist/function/random-test-no.d.ts +0 -5
- package/dist/function/random-test-no.js +0 -5
- package/dist/function/remove-fqn.d.ts +0 -8
- package/dist/function/remove-fqn.js +3 -12
- package/dist/function/run-exporter.d.ts +0 -5
- package/dist/function/run-exporter.js +3 -17
- package/dist/function/secure-clone.js +3 -3
- package/dist/function/secure-json.d.ts +0 -35
- package/dist/function/secure-json.js +12 -54
- package/dist/function/set-anonymous-fqn.js +4 -5
- package/dist/function/set-anonymous-name.js +14 -14
- package/dist/function/set-fqn.d.ts +0 -7
- package/dist/function/set-fqn.js +8 -15
- package/dist/function/set-prop.d.ts +0 -24
- package/dist/function/set-prop.js +6 -30
- package/dist/function/stamp-loader.d.ts +0 -6
- package/dist/function/stamp-loader.js +1 -7
- package/dist/function/test-case.d.ts +0 -7
- package/dist/function/test-case.js +3 -10
- package/dist/function/test-name.d.ts +0 -7
- package/dist/function/test-name.js +2 -9
- package/dist/function/trigger-fqn.js +2 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.foretell.js +7 -10
- package/dist/index.js +10 -11
- package/dist/index.loader.js +1 -8
- package/dist/init/index.js +5 -7
- package/dist/sys/index.d.ts +2 -2
- package/dist/sys/index.js +2 -2
- package/dist/sys/leyyo-storage.d.ts +0 -7
- package/dist/sys/leyyo-storage.js +5 -28
- package/dist/sys/package-json.js +5 -5
- package/package.json +16 -31
|
@@ -3,44 +3,23 @@ import { testCase } from "./test-case.js";
|
|
|
3
3
|
import { $$get_leyyo_fn } from "./leyyo-fn.js";
|
|
4
4
|
const where = `${FQN}.DeleteProp`;
|
|
5
5
|
let _leyyo;
|
|
6
|
-
/**
|
|
7
|
-
* Delete target property
|
|
8
|
-
*
|
|
9
|
-
* @param {any} target - target
|
|
10
|
-
* @param {string} key - key
|
|
11
|
-
* @return {boolean} - is deleted?
|
|
12
|
-
* */
|
|
13
6
|
export function deleteKey(target, key) {
|
|
14
|
-
if (typeof key !==
|
|
7
|
+
if (typeof key !== "string") {
|
|
15
8
|
return false;
|
|
16
9
|
}
|
|
17
10
|
return deleteProp(target, key);
|
|
18
11
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Delete target hidden property
|
|
21
|
-
*
|
|
22
|
-
* @param {any} target - target
|
|
23
|
-
* @param {symbol} key - hidden key
|
|
24
|
-
* @return {boolean} - is deleted?
|
|
25
|
-
* */
|
|
26
12
|
export function deleteSymbol(target, key) {
|
|
27
|
-
if (typeof key !==
|
|
13
|
+
if (typeof key !== "symbol") {
|
|
28
14
|
return false;
|
|
29
15
|
}
|
|
30
16
|
return deleteProp(target, key);
|
|
31
17
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Delete target property
|
|
34
|
-
*
|
|
35
|
-
* @param {any} target - target
|
|
36
|
-
* @param {(symbol|string)} key - key
|
|
37
|
-
* @return {boolean} - is deleted?
|
|
38
|
-
* */
|
|
39
18
|
export function deleteProp(target, key) {
|
|
40
|
-
if (![
|
|
19
|
+
if (!["symbol", "string"].includes(typeof key)) {
|
|
41
20
|
return false;
|
|
42
21
|
}
|
|
43
|
-
if (!target || ![
|
|
22
|
+
if (!target || !["object", "function"].includes(typeof target)) {
|
|
44
23
|
return false;
|
|
45
24
|
}
|
|
46
25
|
try {
|
|
@@ -48,14 +27,13 @@ export function deleteProp(target, key) {
|
|
|
48
27
|
return true;
|
|
49
28
|
}
|
|
50
29
|
catch (e) {
|
|
51
|
-
// nothing
|
|
52
30
|
}
|
|
53
31
|
try {
|
|
54
32
|
Object.defineProperty(target, key, {
|
|
55
33
|
value: undefined,
|
|
56
34
|
configurable: true,
|
|
57
35
|
writable: false,
|
|
58
|
-
enumerable: typeof key ===
|
|
36
|
+
enumerable: typeof key === "string",
|
|
59
37
|
});
|
|
60
38
|
delete target[key];
|
|
61
39
|
return true;
|
|
@@ -64,7 +42,7 @@ export function deleteProp(target, key) {
|
|
|
64
42
|
if (!_leyyo) {
|
|
65
43
|
_leyyo = $$get_leyyo_fn();
|
|
66
44
|
}
|
|
67
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN,
|
|
45
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, "ZZZ"), where).log(e);
|
|
68
46
|
return false;
|
|
69
47
|
}
|
|
70
48
|
}
|
|
@@ -1,54 +1,48 @@
|
|
|
1
1
|
import { List } from "../class/list.js";
|
|
2
2
|
import { KEY_ENUM_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
3
3
|
import { isClass } from "./is-class.js";
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
/**
|
|
6
|
-
* Get extended type of value
|
|
7
|
-
*
|
|
8
|
-
* @param {any} value - given value
|
|
9
|
-
* @return {ExtendedType}
|
|
10
|
-
* */
|
|
11
4
|
export function extendedType(value) {
|
|
5
|
+
let trimmed;
|
|
12
6
|
switch (typeof value) {
|
|
13
7
|
case "string":
|
|
14
|
-
|
|
8
|
+
trimmed = value.trim();
|
|
15
9
|
if (!trimmed) {
|
|
16
|
-
return
|
|
10
|
+
return "empty";
|
|
17
11
|
}
|
|
18
12
|
else if (trimmed === value) {
|
|
19
|
-
return
|
|
13
|
+
return "text";
|
|
20
14
|
}
|
|
21
|
-
return
|
|
22
|
-
case
|
|
15
|
+
return "string";
|
|
16
|
+
case "number":
|
|
23
17
|
if (isNaN(value)) {
|
|
24
|
-
return
|
|
18
|
+
return "nan";
|
|
25
19
|
}
|
|
26
|
-
return Number.isInteger(value) ?
|
|
27
|
-
case
|
|
20
|
+
return Number.isInteger(value) ? "integer" : "number";
|
|
21
|
+
case "object":
|
|
28
22
|
if (!value) {
|
|
29
|
-
return
|
|
23
|
+
return "null";
|
|
30
24
|
}
|
|
31
25
|
if (Array.isArray(value)) {
|
|
32
26
|
if (value[KEY_LITERAL_NAME]) {
|
|
33
|
-
return
|
|
27
|
+
return "literal-items";
|
|
34
28
|
}
|
|
35
|
-
return
|
|
29
|
+
return value instanceof List ? "list" : "array";
|
|
36
30
|
}
|
|
37
31
|
if (value instanceof Date) {
|
|
38
|
-
return
|
|
32
|
+
return "date";
|
|
39
33
|
}
|
|
40
34
|
if (value instanceof Map) {
|
|
41
|
-
return
|
|
35
|
+
return "map";
|
|
42
36
|
}
|
|
43
37
|
if (value instanceof Set) {
|
|
44
|
-
return
|
|
38
|
+
return "set";
|
|
45
39
|
}
|
|
46
40
|
if (value[KEY_ENUM_NAME]) {
|
|
47
|
-
return
|
|
41
|
+
return "enum-map";
|
|
48
42
|
}
|
|
49
|
-
return
|
|
43
|
+
return "object";
|
|
50
44
|
case "function":
|
|
51
|
-
return isClass(value) ?
|
|
45
|
+
return isClass(value) ? "class" : "function";
|
|
52
46
|
default:
|
|
53
47
|
return typeof value;
|
|
54
48
|
}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { FqnTarget } from "./index.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Get fqn name
|
|
4
|
-
*
|
|
5
|
-
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
6
|
-
* @return {string} - fully qualified name
|
|
7
|
-
* */
|
|
8
2
|
export declare function getFqn(target: FqnTarget): string;
|
package/dist/function/get-fqn.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Get fqn name
|
|
4
|
-
*
|
|
5
|
-
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
6
|
-
* @return {string} - fully qualified name
|
|
7
|
-
* */
|
|
8
2
|
export function getFqn(target) {
|
|
9
3
|
if (!target) {
|
|
10
4
|
return undefined;
|
|
11
5
|
}
|
|
12
|
-
if (typeof target ===
|
|
6
|
+
if (typeof target === "function") {
|
|
13
7
|
return target[KEY_FQN_NAME] ?? target.name;
|
|
14
8
|
}
|
|
15
|
-
else if (typeof target ===
|
|
9
|
+
else if (typeof target === "object") {
|
|
16
10
|
if (Array.isArray(target)) {
|
|
17
11
|
if (target[KEY_LITERAL_NAME]) {
|
|
18
12
|
return target[KEY_FQN_NAME] ?? target[KEY_LITERAL_NAME];
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get target property
|
|
3
|
-
*
|
|
4
|
-
* @param {any} target - target
|
|
5
|
-
* @param {string} key - key
|
|
6
|
-
* @return {any}
|
|
7
|
-
* */
|
|
8
1
|
export declare function getKey<T>(target: unknown, key: string): T;
|
|
9
|
-
/**
|
|
10
|
-
* Get target hidden property
|
|
11
|
-
*
|
|
12
|
-
* @param {any} target - target
|
|
13
|
-
* @param {symbol} key - hidden key
|
|
14
|
-
* @return {any}
|
|
15
|
-
* */
|
|
16
2
|
export declare function getSymbol<T>(target: unknown, key: symbol): T;
|
|
17
|
-
/**
|
|
18
|
-
* Get target property
|
|
19
|
-
*
|
|
20
|
-
* @param {any} target - target
|
|
21
|
-
* @param {(symbol|string)} key - key
|
|
22
|
-
* @return {any}
|
|
23
|
-
* */
|
|
24
3
|
export declare function getProp<T>(target: unknown, key: symbol | string): T;
|
|
@@ -3,44 +3,23 @@ import { testCase } from "./test-case.js";
|
|
|
3
3
|
import { $$get_leyyo_fn } from "./leyyo-fn.js";
|
|
4
4
|
const where = `${FQN}.GetProp`;
|
|
5
5
|
let _leyyo;
|
|
6
|
-
/**
|
|
7
|
-
* Get target property
|
|
8
|
-
*
|
|
9
|
-
* @param {any} target - target
|
|
10
|
-
* @param {string} key - key
|
|
11
|
-
* @return {any}
|
|
12
|
-
* */
|
|
13
6
|
export function getKey(target, key) {
|
|
14
|
-
if (typeof key !==
|
|
7
|
+
if (typeof key !== "string") {
|
|
15
8
|
return undefined;
|
|
16
9
|
}
|
|
17
10
|
return getProp(target, key);
|
|
18
11
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Get target hidden property
|
|
21
|
-
*
|
|
22
|
-
* @param {any} target - target
|
|
23
|
-
* @param {symbol} key - hidden key
|
|
24
|
-
* @return {any}
|
|
25
|
-
* */
|
|
26
12
|
export function getSymbol(target, key) {
|
|
27
|
-
if (typeof key !==
|
|
13
|
+
if (typeof key !== "symbol") {
|
|
28
14
|
return undefined;
|
|
29
15
|
}
|
|
30
16
|
return getProp(target, key);
|
|
31
17
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Get target property
|
|
34
|
-
*
|
|
35
|
-
* @param {any} target - target
|
|
36
|
-
* @param {(symbol|string)} key - key
|
|
37
|
-
* @return {any}
|
|
38
|
-
* */
|
|
39
18
|
export function getProp(target, key) {
|
|
40
|
-
if (![
|
|
19
|
+
if (!["symbol", "string"].includes(typeof key)) {
|
|
41
20
|
return undefined;
|
|
42
21
|
}
|
|
43
|
-
if (!target || ![
|
|
22
|
+
if (!target || !["object", "function"].includes(typeof target)) {
|
|
44
23
|
return undefined;
|
|
45
24
|
}
|
|
46
25
|
try {
|
|
@@ -51,7 +30,7 @@ export function getProp(target, key) {
|
|
|
51
30
|
if (!_leyyo) {
|
|
52
31
|
_leyyo = $$get_leyyo_fn();
|
|
53
32
|
}
|
|
54
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN,
|
|
33
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, "ZZZ"), where).log(e);
|
|
55
34
|
return undefined;
|
|
56
35
|
}
|
|
57
36
|
}
|
|
@@ -39,40 +39,20 @@ export interface StatisticsOs {
|
|
|
39
39
|
cpu: Array<StatisticsCpuInfo>;
|
|
40
40
|
}
|
|
41
41
|
export interface StatisticsMemory {
|
|
42
|
-
/**
|
|
43
|
-
* Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the
|
|
44
|
-
* process, including all C++ and JavaScript objects and code.
|
|
45
|
-
*/
|
|
46
42
|
rss: number;
|
|
47
|
-
/**
|
|
48
|
-
* Refers to V8's memory usage.
|
|
49
|
-
*/
|
|
50
43
|
heapTotal: number;
|
|
51
|
-
/**
|
|
52
|
-
* Refers to V8's memory usage.
|
|
53
|
-
*/
|
|
54
44
|
heapUsed: number;
|
|
55
45
|
external: number;
|
|
56
|
-
/**
|
|
57
|
-
* Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included
|
|
58
|
-
* in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s
|
|
59
|
-
* may not be tracked in that case.
|
|
60
|
-
*/
|
|
61
46
|
arrayBuffers: number;
|
|
62
47
|
}
|
|
63
48
|
export interface StatisticsCpuInfo {
|
|
64
49
|
model: string;
|
|
65
50
|
speed: number;
|
|
66
51
|
times: {
|
|
67
|
-
/** The number of milliseconds the CPU has spent in user mode. */
|
|
68
52
|
user: number;
|
|
69
|
-
/** The number of milliseconds the CPU has spent in nice mode. */
|
|
70
53
|
nice: number;
|
|
71
|
-
/** The number of milliseconds the CPU has spent in sys mode. */
|
|
72
54
|
sys: number;
|
|
73
|
-
/** The number of milliseconds the CPU has spent in idle mode. */
|
|
74
55
|
idle: number;
|
|
75
|
-
/** The number of milliseconds the CPU has spent in irq mode. */
|
|
76
56
|
irq: number;
|
|
77
57
|
};
|
|
78
58
|
}
|
|
@@ -6,8 +6,13 @@ export function getStat() {
|
|
|
6
6
|
memory: process.memoryUsage(),
|
|
7
7
|
time: { uptime, startedAt: Date.now() - uptime },
|
|
8
8
|
npm: { pwd: process.env.PWD, version: process.env.npm_config_npm_version },
|
|
9
|
-
node: { type:
|
|
10
|
-
project: {
|
|
9
|
+
node: { type: "module", version: process.env.npm_config_node_version },
|
|
10
|
+
project: {
|
|
11
|
+
name: process.env.npm_package_name,
|
|
12
|
+
version: process.env.npm_package_version,
|
|
13
|
+
environment: process.env.NODE_ENV,
|
|
14
|
+
log: process.env.LOG_LEVEL,
|
|
15
|
+
},
|
|
11
16
|
os: {
|
|
12
17
|
version: os.version(),
|
|
13
18
|
arch: os.arch(),
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { FqnTarget } from "./index.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Get fqn name
|
|
4
|
-
*
|
|
5
|
-
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
6
|
-
* @return {string} - fully qualified name
|
|
7
|
-
* */
|
|
8
2
|
export declare function hasFqn(target: FqnTarget): boolean;
|
package/dist/function/has-fqn.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { KEY_ENUM_NAME, KEY_FQN_NAME, KEY_LITERAL_NAME } from "../const/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Get fqn name
|
|
4
|
-
*
|
|
5
|
-
* @param {FqnTarget} target - target (function, class, instance, enum, literal)
|
|
6
|
-
* @return {string} - fully qualified name
|
|
7
|
-
* */
|
|
8
2
|
export function hasFqn(target) {
|
|
9
3
|
if (!target) {
|
|
10
4
|
return false;
|
|
11
5
|
}
|
|
12
|
-
if (typeof target ===
|
|
6
|
+
if (typeof target === "function") {
|
|
13
7
|
return !!target[KEY_FQN_NAME];
|
|
14
8
|
}
|
|
15
|
-
else if (typeof target ===
|
|
9
|
+
else if (typeof target === "object") {
|
|
16
10
|
if (Array.isArray(target)) {
|
|
17
11
|
if (target[KEY_LITERAL_NAME]) {
|
|
18
12
|
return !!target[KEY_FQN_NAME];
|
package/dist/function/index.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
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
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
37
|
-
export * from
|
|
38
|
-
export * from
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./define-loader.js";
|
|
3
|
+
export * from "./delay.js";
|
|
4
|
+
export * from "./delete-prop.js";
|
|
5
|
+
export * from "./empty-fn.js";
|
|
6
|
+
export * from "./extended-type.js";
|
|
7
|
+
export * from "./get-fqn.js";
|
|
8
|
+
export * from "./get-stat.js";
|
|
9
|
+
export * from "./set-fqn.js";
|
|
10
|
+
export * from "./remove-fqn.js";
|
|
11
|
+
export * from "./on-fqn-set.js";
|
|
12
|
+
export * from "./set-anonymous-fqn.js";
|
|
13
|
+
export * from "./get-prop.js";
|
|
14
|
+
export * from "./has-fqn.js";
|
|
15
|
+
export * from "./is-class.js";
|
|
16
|
+
export * from "./is-empty.js";
|
|
17
|
+
export * from "./is-filled-arr.js";
|
|
18
|
+
export * from "./is-filled-obj.js";
|
|
19
|
+
export * from "./is-obj.js";
|
|
20
|
+
export * from "./is-text.js";
|
|
21
|
+
export * from "./is-anonymous-name.js";
|
|
22
|
+
export * from "./jitter-interval.js";
|
|
23
|
+
export * from "./load-config.js";
|
|
24
|
+
export * from "./stamp-loader.js";
|
|
25
|
+
export * from "./one-or-more.js";
|
|
26
|
+
export * from "./opt-add.js";
|
|
27
|
+
export * from "./opt-append.js";
|
|
28
|
+
export * from "./opt-check.js";
|
|
29
|
+
export * from "./opt-clone.js";
|
|
30
|
+
export * from "./opt-field.js";
|
|
31
|
+
export * from "./opt-fn.js";
|
|
32
|
+
export * from "./run-exporter.js";
|
|
33
|
+
export * from "./secure-clone.js";
|
|
34
|
+
export * from "./secure-json.js";
|
|
35
|
+
export * from "./set-anonymous-name.js";
|
|
36
|
+
export * from "./set-prop.js";
|
|
37
|
+
export * from "./test-case.js";
|
|
38
|
+
export * from "./test-name.js";
|
|
39
|
+
export * from "./random-test-no.js";
|
|
40
|
+
export * from "./is-test.js";
|
package/dist/function/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
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
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
37
|
-
export * from
|
|
38
|
-
export * from
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./define-loader.js";
|
|
3
|
+
export * from "./delay.js";
|
|
4
|
+
export * from "./delete-prop.js";
|
|
5
|
+
export * from "./empty-fn.js";
|
|
6
|
+
export * from "./extended-type.js";
|
|
7
|
+
export * from "./get-fqn.js";
|
|
8
|
+
export * from "./get-stat.js";
|
|
9
|
+
export * from "./set-fqn.js";
|
|
10
|
+
export * from "./remove-fqn.js";
|
|
11
|
+
export * from "./on-fqn-set.js";
|
|
12
|
+
export * from "./set-anonymous-fqn.js";
|
|
13
|
+
export * from "./get-prop.js";
|
|
14
|
+
export * from "./has-fqn.js";
|
|
15
|
+
export * from "./is-class.js";
|
|
16
|
+
export * from "./is-empty.js";
|
|
17
|
+
export * from "./is-filled-arr.js";
|
|
18
|
+
export * from "./is-filled-obj.js";
|
|
19
|
+
export * from "./is-obj.js";
|
|
20
|
+
export * from "./is-text.js";
|
|
21
|
+
export * from "./is-anonymous-name.js";
|
|
22
|
+
export * from "./jitter-interval.js";
|
|
23
|
+
export * from "./load-config.js";
|
|
24
|
+
export * from "./stamp-loader.js";
|
|
25
|
+
export * from "./one-or-more.js";
|
|
26
|
+
export * from "./opt-add.js";
|
|
27
|
+
export * from "./opt-append.js";
|
|
28
|
+
export * from "./opt-check.js";
|
|
29
|
+
export * from "./opt-clone.js";
|
|
30
|
+
export * from "./opt-field.js";
|
|
31
|
+
export * from "./opt-fn.js";
|
|
32
|
+
export * from "./run-exporter.js";
|
|
33
|
+
export * from "./secure-clone.js";
|
|
34
|
+
export * from "./secure-json.js";
|
|
35
|
+
export * from "./set-anonymous-name.js";
|
|
36
|
+
export * from "./set-prop.js";
|
|
37
|
+
export * from "./test-case.js";
|
|
38
|
+
export * from "./test-name.js";
|
|
39
|
+
export * from "./random-test-no.js";
|
|
40
|
+
export * from "./is-test.js";
|
|
@@ -6,7 +6,7 @@ export type LoaderLike = Array<LoaderItem>;
|
|
|
6
6
|
export type LeyyoStampLambda = () => LoaderItem;
|
|
7
7
|
export type LeyyoStampEmpty = () => symbol;
|
|
8
8
|
export type LoaderItem = ClassLike | Fnc | Enum | Literal | Obj | LeyyoStampLambda | LeyyoStampEmpty | LoaderLike;
|
|
9
|
-
export type OptReason =
|
|
9
|
+
export type OptReason = "invalid" | "unexpected" | "not:allowed" | "not:found" | "duplicated" | "empty" | "conflicted";
|
|
10
10
|
export interface Opt<R extends string = string> extends Obj {
|
|
11
11
|
issue?: SetOrMore<OptReason | R | string>;
|
|
12
12
|
message?: SetOrMore<string>;
|
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Is class?
|
|
3
|
-
*
|
|
4
|
-
* @param {any} fn - given value
|
|
5
|
-
* @return {boolean} - is class?
|
|
6
|
-
* */
|
|
7
1
|
export function isClass(fn) {
|
|
8
|
-
if (typeof fn !==
|
|
2
|
+
if (typeof fn !== "function") {
|
|
9
3
|
return false;
|
|
10
4
|
}
|
|
11
5
|
try {
|
|
12
|
-
return Function.prototype.toString.call(fn).toString().startsWith(
|
|
6
|
+
return Function.prototype.toString.call(fn).toString().startsWith("class ");
|
|
13
7
|
}
|
|
14
8
|
catch (e) {
|
|
15
9
|
return false;
|
|
16
10
|
}
|
|
17
|
-
// // Class constructor is also a function
|
|
18
|
-
// if ( !(fn && fn.constructor === Function) || (fn as Fnc).prototype === undefined) {
|
|
19
|
-
// return false;
|
|
20
|
-
// }
|
|
21
|
-
//
|
|
22
|
-
// // This is a class that extends other class
|
|
23
|
-
// if (Function.prototype !== Object.getPrototypeOf(fn)) {
|
|
24
|
-
// return true;
|
|
25
|
-
// }
|
|
26
|
-
//
|
|
27
|
-
// // Usually a function will only have 'constructor' in the prototype
|
|
28
|
-
// return Object.getOwnPropertyNames((fn as Fnc).prototype).length > 1;
|
|
29
11
|
}
|
|
@@ -1,12 +1 @@
|
|
|
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
1
|
export declare function isEmpty(value: unknown, notSpace?: boolean): boolean;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
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
2
|
export function isEmpty(value, notSpace) {
|
|
14
3
|
if (notSpace) {
|
|
15
4
|
return EMPTY_VALUES.includes(value);
|
|
16
5
|
}
|
|
17
|
-
return EMPTY_VALUES.includes(value) || (typeof value ===
|
|
6
|
+
return EMPTY_VALUES.includes(value) || (typeof value === "string" && !value.trim());
|
|
18
7
|
}
|