@e-mc/types 0.9.26 → 0.9.28
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 +13 -13
- package/lib/dom.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.28/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -194,8 +194,8 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
194
194
|
|
|
195
195
|
## References
|
|
196
196
|
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
198
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.9.28/lib/logger.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.9.28/lib/module.d.ts
|
|
199
199
|
|
|
200
200
|
* https://nodejs.org/api/perf_hooks.html
|
|
201
201
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -922,23 +922,23 @@ function asFunction(value, sync = true) {
|
|
|
922
922
|
return null;
|
|
923
923
|
}
|
|
924
924
|
exports.asFunction = asFunction;
|
|
925
|
-
function getEncoding(value, fallback
|
|
925
|
+
function getEncoding(value, fallback) {
|
|
926
926
|
if (typeof value === 'string') {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
927
|
+
const result = value.trim().toLowerCase();
|
|
928
|
+
if (result.slice(0, 3) === 'utf') {
|
|
929
|
+
switch (result.slice(result[3] === '-' ? 4 : 3)) {
|
|
930
|
+
case '8':
|
|
931
|
+
return 'utf-8';
|
|
932
|
+
case '16le':
|
|
933
|
+
case '16':
|
|
934
|
+
return 'utf16le';
|
|
935
|
+
}
|
|
936
936
|
}
|
|
937
|
-
if (Buffer.isEncoding(
|
|
938
|
-
return
|
|
937
|
+
else if (Buffer.isEncoding(result)) {
|
|
938
|
+
return result;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
|
-
return fallback;
|
|
941
|
+
return fallback || 'utf-8';
|
|
942
942
|
}
|
|
943
943
|
exports.getEncoding = getEncoding;
|
|
944
944
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
package/lib/dom.d.ts
ADDED