@e-mc/types 0.8.28 → 0.8.29
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/README.md +3 -3
- package/constant.d.ts +1 -1
- package/index.js +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.29/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -186,8 +186,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
186
186
|
|
|
187
187
|
## References
|
|
188
188
|
|
|
189
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
190
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
189
|
+
- https://www.unpkg.com/@e-mc/types@0.8.29/lib/logger.d.ts
|
|
190
|
+
- https://www.unpkg.com/@e-mc/types@0.8.29/lib/module.d.ts
|
|
191
191
|
|
|
192
192
|
* https://nodejs.org/api/perf_hooks.html
|
|
193
193
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -854,23 +854,23 @@ function asFunction(value, sync = true) {
|
|
|
854
854
|
return null;
|
|
855
855
|
}
|
|
856
856
|
exports.asFunction = asFunction;
|
|
857
|
-
function getEncoding(value, fallback
|
|
857
|
+
function getEncoding(value, fallback) {
|
|
858
858
|
if (typeof value === 'string') {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
if (Buffer.isEncoding(
|
|
870
|
-
return
|
|
859
|
+
const result = value.trim().toLowerCase();
|
|
860
|
+
if (result.slice(0, 3) === 'utf') {
|
|
861
|
+
switch (result.slice(result[3] === '-' ? 4 : 3)) {
|
|
862
|
+
case '8':
|
|
863
|
+
return 'utf-8';
|
|
864
|
+
case '16le':
|
|
865
|
+
case '16':
|
|
866
|
+
return 'utf16le';
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
else if (Buffer.isEncoding(result)) {
|
|
870
|
+
return result;
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
|
-
return fallback;
|
|
873
|
+
return fallback || 'utf-8';
|
|
874
874
|
}
|
|
875
875
|
exports.getEncoding = getEncoding;
|
|
876
876
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|