@e-mc/module 0.7.10 → 0.7.12
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/index.js +18 -24
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -586,7 +586,7 @@ class Module extends EventEmitter {
|
|
|
586
586
|
this[_f] = new AbortController();
|
|
587
587
|
this[_g] = null;
|
|
588
588
|
}
|
|
589
|
-
static get VERSION() { return "0.7.
|
|
589
|
+
static get VERSION() { return "0.7.12"; }
|
|
590
590
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
591
591
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
592
592
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -1097,40 +1097,34 @@ class Module extends EventEmitter {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
return cacheKey ? (0, types_1.generateUUID)() : '';
|
|
1099
1099
|
}
|
|
1100
|
-
static asHash(data, algorithm,
|
|
1101
|
-
if (!algorithm && !
|
|
1100
|
+
static asHash(data, algorithm, digest) {
|
|
1101
|
+
if (!algorithm && !digest) {
|
|
1102
1102
|
return crypto.createHash("sha256").update(data).digest("hex");
|
|
1103
1103
|
}
|
|
1104
|
-
let options
|
|
1105
|
-
if (
|
|
1106
|
-
options =
|
|
1107
|
-
minLength = 0;
|
|
1108
|
-
}
|
|
1109
|
-
if (typeof algorithm === 'number') {
|
|
1110
|
-
minLength = algorithm;
|
|
1111
|
-
algorithm = undefined;
|
|
1112
|
-
}
|
|
1113
|
-
else if ((0, types_1.isObject)(algorithm)) {
|
|
1114
|
-
options = algorithm;
|
|
1115
|
-
algorithm = undefined;
|
|
1116
|
-
}
|
|
1117
|
-
if (options) {
|
|
1118
|
-
options = { ...options };
|
|
1119
|
-
if ('minLength' in options) {
|
|
1120
|
-
minLength = options.minLength;
|
|
1121
|
-
delete options.minLength;
|
|
1122
|
-
}
|
|
1104
|
+
let options;
|
|
1105
|
+
if ((0, types_1.isObject)(algorithm)) {
|
|
1106
|
+
options = { ...algorithm };
|
|
1123
1107
|
if ('algorithm' in options) {
|
|
1124
1108
|
algorithm = options.algorithm;
|
|
1125
1109
|
delete options.algorithm;
|
|
1126
1110
|
}
|
|
1111
|
+
else {
|
|
1112
|
+
algorithm = undefined;
|
|
1113
|
+
}
|
|
1127
1114
|
if ('digest' in options) {
|
|
1128
1115
|
digest = options.digest;
|
|
1129
1116
|
delete options.digest;
|
|
1130
1117
|
}
|
|
1118
|
+
else {
|
|
1119
|
+
digest = undefined;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
else if ((0, types_1.isObject)(digest)) {
|
|
1123
|
+
options = digest;
|
|
1124
|
+
digest = undefined;
|
|
1131
1125
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1126
|
+
else if (typeof digest !== 'string') {
|
|
1127
|
+
digest = undefined;
|
|
1134
1128
|
}
|
|
1135
1129
|
try {
|
|
1136
1130
|
return crypto.createHash(algorithm || "sha256", options).update(data).digest(digest || "hex");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.7.
|
|
23
|
+
"@e-mc/types": "0.7.12",
|
|
24
24
|
"abort-controller": "^3.0.0",
|
|
25
25
|
"chalk": "4.1.2",
|
|
26
26
|
"event-target-shim": "^5.0.1",
|