@leyyo/common 1.3.18 → 1.3.20
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 -3
- package/dist/base/leyyo.js +1 -1
- package/dist/class/index.d.ts +2 -2
- package/dist/class/index.js +2 -2
- package/dist/class/logger.instance.d.ts +6 -6
- package/dist/class/logger.instance.js +11 -12
- package/dist/common/deploy.common.js +4 -4
- package/dist/common/enum.pool.d.ts +5 -3
- package/dist/common/enum.pool.js +16 -3
- package/dist/common/error.common.js +33 -29
- package/dist/common/error.pool.d.ts +1 -1
- package/dist/common/error.pool.js +2 -3
- package/dist/common/event.common.js +12 -9
- package/dist/common/index.d.ts +11 -11
- package/dist/common/index.js +11 -11
- package/dist/common/index.types.d.ts +18 -9
- package/dist/common/inert.d.ts +1 -1
- package/dist/common/inert.js +35 -35
- package/dist/common/lifecycle.common.js +13 -13
- package/dist/common/literal.pool.d.ts +1 -1
- package/dist/common/literal.pool.js +3 -3
- package/dist/common/log.common.js +68 -63
- package/dist/common/repo.common.js +23 -28
- package/dist/const/index.d.ts +0 -1
- package/dist/const/index.js +28 -29
- package/dist/enum/index.d.ts +1 -1
- package/dist/enum/index.js +1 -1
- package/dist/enum/log-level.d.ts +1 -1
- package/dist/enum/log-level.js +1 -1
- package/dist/error/developer.error.d.ts +1 -2
- package/dist/error/developer.error.js +6 -15
- package/dist/error/http.error.js +1 -1
- package/dist/error/index.d.ts +7 -7
- package/dist/error/index.js +7 -7
- package/dist/error/index.types.d.ts +1 -1
- package/dist/error/invalid-value.error.js +1 -1
- package/dist/error/leyyo.error.js +25 -21
- package/dist/error/multiple.error.js +2 -2
- package/dist/function/delete-prop.js +6 -6
- package/dist/function/empty-fn.js +1 -2
- package/dist/function/extended-type.js +18 -17
- package/dist/function/get-fqn.js +3 -2
- package/dist/function/get-prop.js +5 -5
- package/dist/function/get-stat.js +7 -2
- package/dist/function/has-fqn.js +3 -2
- 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.js +2 -2
- package/dist/function/is-empty.js +1 -1
- package/dist/function/is-obj.js +1 -1
- package/dist/function/is-test.js +3 -5
- package/dist/function/is-text.js +1 -1
- package/dist/function/jitter-interval.js +2 -2
- package/dist/function/load-config.js +9 -9
- package/dist/function/on-fqn-set.js +4 -3
- package/dist/function/opt-add.js +2 -2
- package/dist/function/opt-check.js +2 -2
- package/dist/function/opt-field.js +6 -6
- package/dist/function/remove-fqn.js +3 -2
- package/dist/function/run-exporter.js +3 -3
- package/dist/function/secure-clone.js +3 -3
- package/dist/function/secure-json.js +12 -10
- package/dist/function/set-anonymous-fqn.js +5 -4
- package/dist/function/set-anonymous-name.js +14 -14
- package/dist/function/set-fqn.js +9 -8
- package/dist/function/set-prop.js +6 -6
- package/dist/function/stamp-loader.js +1 -1
- package/dist/function/test-case.js +3 -3
- package/dist/function/test-name.js +2 -2
- package/dist/function/trigger-fqn.js +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.foretell.js +7 -7
- package/dist/index.js +10 -10
- package/dist/index.loader.js +3 -3
- 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.js +5 -5
- package/dist/sys/package-json.js +5 -5
- package/package.json +16 -31
package/dist/error/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./caused.error.js";
|
|
3
|
+
export * from "./developer.error.js";
|
|
4
|
+
export * from "./http.error.js";
|
|
5
|
+
export * from "./invalid-value.error.js";
|
|
6
|
+
export * from "./leyyo.error.js";
|
|
7
|
+
export * from "./multiple.error.js";
|
|
@@ -42,7 +42,7 @@ export interface DeveloperErrorCtor {
|
|
|
42
42
|
* */
|
|
43
43
|
new (message: string, issue?: string, where?: string): DeveloperErrorLike;
|
|
44
44
|
}
|
|
45
|
-
export type LeyyoErrorTag =
|
|
45
|
+
export type LeyyoErrorTag = "printed" | "sent";
|
|
46
46
|
/**
|
|
47
47
|
* Stack line
|
|
48
48
|
* */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getFqn, getSymbol, isFilledObj, isObj, optAdd, optAppend, setSymbol } from "../function/index.js";
|
|
2
|
-
import { KEY_ERROR_FLAGS, KEY_ERROR_WHERE, KEY_LEYYO_SECURE, VAL_ERROR_UNKNOWN_MESSAGE } from "../const/index.js";
|
|
1
|
+
import { getFqn, getSymbol, isFilledObj, isObj, optAdd, optAppend, setSymbol, } from "../function/index.js";
|
|
2
|
+
import { KEY_ERROR_FLAGS, KEY_ERROR_WHERE, KEY_LEYYO_SECURE, VAL_ERROR_UNKNOWN_MESSAGE, } from "../const/index.js";
|
|
3
3
|
let _leyyo;
|
|
4
4
|
// region property
|
|
5
|
-
const _errorField = [
|
|
6
|
-
const _leyyoErrorFields = [..._errorField,
|
|
5
|
+
const _errorField = ["name", "message", "stack"];
|
|
6
|
+
const _leyyoErrorFields = [..._errorField, "params", "causedBy", "stackTrace"];
|
|
7
7
|
// endregion property
|
|
8
8
|
/**
|
|
9
9
|
* Leyyo base error
|
|
@@ -32,7 +32,7 @@ export class LeyyoError extends Error {
|
|
|
32
32
|
constructor(p1, p2) {
|
|
33
33
|
let message;
|
|
34
34
|
let params;
|
|
35
|
-
if (typeof p1 ===
|
|
35
|
+
if (typeof p1 === "string") {
|
|
36
36
|
message = p1;
|
|
37
37
|
params = p2;
|
|
38
38
|
}
|
|
@@ -47,7 +47,7 @@ export class LeyyoError extends Error {
|
|
|
47
47
|
const conf = _leyyo.errorCommon.getConfigItem(clazz);
|
|
48
48
|
this.message = conf?.message;
|
|
49
49
|
}
|
|
50
|
-
if (params && typeof params ===
|
|
50
|
+
if (params && typeof params === "object" && !Array.isArray(params)) {
|
|
51
51
|
this.params = params;
|
|
52
52
|
}
|
|
53
53
|
this.name = getFqn(clazz);
|
|
@@ -78,19 +78,19 @@ export class LeyyoError extends Error {
|
|
|
78
78
|
return this;
|
|
79
79
|
}
|
|
80
80
|
where(p1, fqn) {
|
|
81
|
-
if (typeof p1 ===
|
|
81
|
+
if (typeof p1 === "function") {
|
|
82
82
|
setSymbol(this, KEY_ERROR_WHERE, getFqn(p1));
|
|
83
83
|
}
|
|
84
|
-
else if (p1 && typeof p1 ===
|
|
84
|
+
else if (p1 && typeof p1 === "object") {
|
|
85
85
|
setSymbol(this, KEY_ERROR_WHERE, getFqn(p1));
|
|
86
86
|
}
|
|
87
|
-
else if (p1 && typeof p1 ===
|
|
88
|
-
if (typeof fqn ===
|
|
87
|
+
else if (p1 && typeof p1 === "string" && p1.trim()) {
|
|
88
|
+
if (typeof fqn === "string") {
|
|
89
89
|
fqn = fqn.trim();
|
|
90
|
-
fqn = fqn ? `${fqn}.` :
|
|
90
|
+
fqn = fqn ? `${fqn}.` : "";
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
fqn =
|
|
93
|
+
fqn = "";
|
|
94
94
|
}
|
|
95
95
|
setSymbol(this, KEY_ERROR_WHERE, fqn + p1.trim());
|
|
96
96
|
}
|
|
@@ -108,29 +108,29 @@ export class LeyyoError extends Error {
|
|
|
108
108
|
}
|
|
109
109
|
/** @inheritDoc */
|
|
110
110
|
log(logger) {
|
|
111
|
-
this._log(
|
|
111
|
+
this._log("error", logger);
|
|
112
112
|
}
|
|
113
113
|
logFatal(logger) {
|
|
114
|
-
this._log(
|
|
114
|
+
this._log("fatal", logger);
|
|
115
115
|
}
|
|
116
116
|
logError(logger) {
|
|
117
|
-
this._log(
|
|
117
|
+
this._log("error", logger);
|
|
118
118
|
}
|
|
119
119
|
/** @inheritDoc */
|
|
120
120
|
logWarn(logger) {
|
|
121
|
-
this._log(
|
|
121
|
+
this._log("warn", logger);
|
|
122
122
|
}
|
|
123
123
|
/** @inheritDoc */
|
|
124
124
|
logDebug(logger) {
|
|
125
|
-
this._log(
|
|
125
|
+
this._log("debug", logger);
|
|
126
126
|
}
|
|
127
127
|
/** @inheritDoc */
|
|
128
128
|
logInfo(logger) {
|
|
129
|
-
this._log(
|
|
129
|
+
this._log("info", logger);
|
|
130
130
|
}
|
|
131
131
|
/** @inheritDoc */
|
|
132
132
|
logTrace(logger) {
|
|
133
|
-
this._log(
|
|
133
|
+
this._log("trace", logger);
|
|
134
134
|
}
|
|
135
135
|
// endregion log
|
|
136
136
|
// region flags
|
|
@@ -184,7 +184,9 @@ export class LeyyoError extends Error {
|
|
|
184
184
|
}
|
|
185
185
|
if (source instanceof LeyyoError) {
|
|
186
186
|
for (const [k, v] of Object.entries(source)) {
|
|
187
|
-
if (!_leyyoErrorFields.includes(k) &&
|
|
187
|
+
if (!_leyyoErrorFields.includes(k) &&
|
|
188
|
+
typeof k === "string" &&
|
|
189
|
+
!["symbol", "function", "undefined"].includes(typeof v)) {
|
|
188
190
|
optAdd(this.params, k, v);
|
|
189
191
|
}
|
|
190
192
|
if (isFilledObj(source.params)) {
|
|
@@ -194,7 +196,9 @@ export class LeyyoError extends Error {
|
|
|
194
196
|
}
|
|
195
197
|
else {
|
|
196
198
|
for (const [k, v] of Object.entries(source)) {
|
|
197
|
-
if (!_errorField.includes(k) &&
|
|
199
|
+
if (!_errorField.includes(k) &&
|
|
200
|
+
typeof k === "string" &&
|
|
201
|
+
!["symbol", "function", "undefined"].includes(typeof v)) {
|
|
198
202
|
optAdd(this.params, k, v);
|
|
199
203
|
}
|
|
200
204
|
}
|
|
@@ -10,12 +10,12 @@ export class MultipleError extends LeyyoError {
|
|
|
10
10
|
* */
|
|
11
11
|
constructor(...errors) {
|
|
12
12
|
const first = errors.length > 0 ? errors[0] : undefined;
|
|
13
|
-
super(first?.message ??
|
|
13
|
+
super(first?.message ?? "Multiple error", {});
|
|
14
14
|
this.causedBy = [];
|
|
15
15
|
this.push(...errors);
|
|
16
16
|
}
|
|
17
17
|
push(...errors) {
|
|
18
|
-
errors.forEach(e => {
|
|
18
|
+
errors.forEach((e) => {
|
|
19
19
|
if (e instanceof MultipleError) {
|
|
20
20
|
this.causedBy.push(...e.causedBy);
|
|
21
21
|
}
|
|
@@ -11,7 +11,7 @@ let _leyyo;
|
|
|
11
11
|
* @return {boolean} - is deleted?
|
|
12
12
|
* */
|
|
13
13
|
export function deleteKey(target, key) {
|
|
14
|
-
if (typeof key !==
|
|
14
|
+
if (typeof key !== "string") {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
return deleteProp(target, key);
|
|
@@ -24,7 +24,7 @@ export function deleteKey(target, key) {
|
|
|
24
24
|
* @return {boolean} - is deleted?
|
|
25
25
|
* */
|
|
26
26
|
export function deleteSymbol(target, key) {
|
|
27
|
-
if (typeof key !==
|
|
27
|
+
if (typeof key !== "symbol") {
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
30
|
return deleteProp(target, key);
|
|
@@ -37,10 +37,10 @@ export function deleteSymbol(target, key) {
|
|
|
37
37
|
* @return {boolean} - is deleted?
|
|
38
38
|
* */
|
|
39
39
|
export function deleteProp(target, key) {
|
|
40
|
-
if (![
|
|
40
|
+
if (!["symbol", "string"].includes(typeof key)) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
if (!target || ![
|
|
43
|
+
if (!target || !["object", "function"].includes(typeof target)) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
try {
|
|
@@ -55,7 +55,7 @@ export function deleteProp(target, key) {
|
|
|
55
55
|
value: undefined,
|
|
56
56
|
configurable: true,
|
|
57
57
|
writable: false,
|
|
58
|
-
enumerable: typeof key ===
|
|
58
|
+
enumerable: typeof key === "string",
|
|
59
59
|
});
|
|
60
60
|
delete target[key];
|
|
61
61
|
return true;
|
|
@@ -64,7 +64,7 @@ export function deleteProp(target, key) {
|
|
|
64
64
|
if (!_leyyo) {
|
|
65
65
|
_leyyo = $$get_leyyo_fn();
|
|
66
66
|
}
|
|
67
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN,
|
|
67
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, "ZZZ"), where).log(e);
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -9,46 +9,47 @@ import { isClass } from "./is-class.js";
|
|
|
9
9
|
* @return {ExtendedType}
|
|
10
10
|
* */
|
|
11
11
|
export function extendedType(value) {
|
|
12
|
+
let trimmed;
|
|
12
13
|
switch (typeof value) {
|
|
13
14
|
case "string":
|
|
14
|
-
|
|
15
|
+
trimmed = value.trim();
|
|
15
16
|
if (!trimmed) {
|
|
16
|
-
return
|
|
17
|
+
return "empty";
|
|
17
18
|
}
|
|
18
19
|
else if (trimmed === value) {
|
|
19
|
-
return
|
|
20
|
+
return "text";
|
|
20
21
|
}
|
|
21
|
-
return
|
|
22
|
-
case
|
|
22
|
+
return "string";
|
|
23
|
+
case "number":
|
|
23
24
|
if (isNaN(value)) {
|
|
24
|
-
return
|
|
25
|
+
return "nan";
|
|
25
26
|
}
|
|
26
|
-
return Number.isInteger(value) ?
|
|
27
|
-
case
|
|
27
|
+
return Number.isInteger(value) ? "integer" : "number";
|
|
28
|
+
case "object":
|
|
28
29
|
if (!value) {
|
|
29
|
-
return
|
|
30
|
+
return "null";
|
|
30
31
|
}
|
|
31
32
|
if (Array.isArray(value)) {
|
|
32
33
|
if (value[KEY_LITERAL_NAME]) {
|
|
33
|
-
return
|
|
34
|
+
return "literal-items";
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return value instanceof List ? "list" : "array";
|
|
36
37
|
}
|
|
37
38
|
if (value instanceof Date) {
|
|
38
|
-
return
|
|
39
|
+
return "date";
|
|
39
40
|
}
|
|
40
41
|
if (value instanceof Map) {
|
|
41
|
-
return
|
|
42
|
+
return "map";
|
|
42
43
|
}
|
|
43
44
|
if (value instanceof Set) {
|
|
44
|
-
return
|
|
45
|
+
return "set";
|
|
45
46
|
}
|
|
46
47
|
if (value[KEY_ENUM_NAME]) {
|
|
47
|
-
return
|
|
48
|
+
return "enum-map";
|
|
48
49
|
}
|
|
49
|
-
return
|
|
50
|
+
return "object";
|
|
50
51
|
case "function":
|
|
51
|
-
return isClass(value) ?
|
|
52
|
+
return isClass(value) ? "class" : "function";
|
|
52
53
|
default:
|
|
53
54
|
return typeof value;
|
|
54
55
|
}
|
package/dist/function/get-fqn.js
CHANGED
|
@@ -9,10 +9,11 @@ export function getFqn(target) {
|
|
|
9
9
|
if (!target) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
if (typeof target ===
|
|
12
|
+
if (typeof target === "function") {
|
|
13
|
+
// function, class
|
|
13
14
|
return target[KEY_FQN_NAME] ?? target.name;
|
|
14
15
|
}
|
|
15
|
-
else if (typeof target ===
|
|
16
|
+
else if (typeof target === "object") {
|
|
16
17
|
if (Array.isArray(target)) {
|
|
17
18
|
if (target[KEY_LITERAL_NAME]) {
|
|
18
19
|
return target[KEY_FQN_NAME] ?? target[KEY_LITERAL_NAME];
|
|
@@ -11,7 +11,7 @@ let _leyyo;
|
|
|
11
11
|
* @return {any}
|
|
12
12
|
* */
|
|
13
13
|
export function getKey(target, key) {
|
|
14
|
-
if (typeof key !==
|
|
14
|
+
if (typeof key !== "string") {
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
17
|
return getProp(target, key);
|
|
@@ -24,7 +24,7 @@ export function getKey(target, key) {
|
|
|
24
24
|
* @return {any}
|
|
25
25
|
* */
|
|
26
26
|
export function getSymbol(target, key) {
|
|
27
|
-
if (typeof key !==
|
|
27
|
+
if (typeof key !== "symbol") {
|
|
28
28
|
return undefined;
|
|
29
29
|
}
|
|
30
30
|
return getProp(target, key);
|
|
@@ -37,10 +37,10 @@ export function getSymbol(target, key) {
|
|
|
37
37
|
* @return {any}
|
|
38
38
|
* */
|
|
39
39
|
export function getProp(target, key) {
|
|
40
|
-
if (![
|
|
40
|
+
if (!["symbol", "string"].includes(typeof key)) {
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
|
-
if (!target || ![
|
|
43
|
+
if (!target || !["object", "function"].includes(typeof target)) {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
46
|
try {
|
|
@@ -51,7 +51,7 @@ export function getProp(target, key) {
|
|
|
51
51
|
if (!_leyyo) {
|
|
52
52
|
_leyyo = $$get_leyyo_fn();
|
|
53
53
|
}
|
|
54
|
-
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN,
|
|
54
|
+
new _leyyo.developerError(`Unexpected error during set name [${key.toString()}]`, testCase(FQN, "ZZZ"), where).log(e);
|
|
55
55
|
return undefined;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -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(),
|
package/dist/function/has-fqn.js
CHANGED
|
@@ -9,10 +9,11 @@ export function hasFqn(target) {
|
|
|
9
9
|
if (!target) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
|
-
if (typeof target ===
|
|
12
|
+
if (typeof target === "function") {
|
|
13
|
+
// function, class
|
|
13
14
|
return !!target[KEY_FQN_NAME];
|
|
14
15
|
}
|
|
15
|
-
else if (typeof target ===
|
|
16
|
+
else if (typeof target === "object") {
|
|
16
17
|
if (Array.isArray(target)) {
|
|
17
18
|
if (target[KEY_LITERAL_NAME]) {
|
|
18
19
|
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>;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* @return {boolean} - is class?
|
|
6
6
|
* */
|
|
7
7
|
export function isClass(fn) {
|
|
8
|
-
if (typeof fn !==
|
|
8
|
+
if (typeof fn !== "function") {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
return Function.prototype.toString.call(fn).toString().startsWith(
|
|
12
|
+
return Function.prototype.toString.call(fn).toString().startsWith("class ");
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
15
|
return false;
|
|
@@ -14,5 +14,5 @@ export function isEmpty(value, notSpace) {
|
|
|
14
14
|
if (notSpace) {
|
|
15
15
|
return EMPTY_VALUES.includes(value);
|
|
16
16
|
}
|
|
17
|
-
return EMPTY_VALUES.includes(value) || (typeof value ===
|
|
17
|
+
return EMPTY_VALUES.includes(value) || (typeof value === "string" && !value.trim());
|
|
18
18
|
}
|
package/dist/function/is-obj.js
CHANGED
package/dist/function/is-test.js
CHANGED
|
@@ -13,11 +13,9 @@ export function initTest() {
|
|
|
13
13
|
if (global) {
|
|
14
14
|
if (!global.leyyo_is_testing) {
|
|
15
15
|
global.leyyo_is_testing = true;
|
|
16
|
-
[
|
|
17
|
-
global.console[name] = () => {
|
|
18
|
-
};
|
|
19
|
-
console[name] = () => {
|
|
20
|
-
};
|
|
16
|
+
["log", "warn", "info", "debug", "trace", "error", "fatal"].forEach((name) => {
|
|
17
|
+
global.console[name] = () => { };
|
|
18
|
+
console[name] = () => { };
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
21
|
}
|
package/dist/function/is-text.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @return {number} - next interval time if (maxTryCount && `tryCount` >= `maxTryCount`)
|
|
10
10
|
* */
|
|
11
11
|
export function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
|
|
12
|
-
if ([tryCount, baseDelay, maxDelay].some(v => !isValid(v))) {
|
|
12
|
+
if ([tryCount, baseDelay, maxDelay].some((v) => !isValid(v))) {
|
|
13
13
|
return undefined;
|
|
14
14
|
}
|
|
15
15
|
if (isValid(maxTryCount) && tryCount >= maxTryCount) {
|
|
@@ -26,5 +26,5 @@ export function jitterInterval(tryCount, baseDelay, maxDelay, maxTryCount) {
|
|
|
26
26
|
* @return {boolean} - is it expected?
|
|
27
27
|
* */
|
|
28
28
|
function isValid(value) {
|
|
29
|
-
return typeof value ===
|
|
29
|
+
return (typeof value === "number" && value > 0 && Number.isInteger(value) && Number.isSafeInteger(value));
|
|
30
30
|
}
|