@e-mc/types 0.10.18 → 0.10.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/README.md +5 -5
- package/constant.d.ts +1 -1
- package/index.js +13 -14
- 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.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.19/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -197,10 +197,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
197
197
|
|
|
198
198
|
## References
|
|
199
199
|
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
203
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.10.19/index.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.10.19/lib/logger.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.10.19/lib/module.d.ts
|
|
203
|
+
- https://www.unpkg.com/@e-mc/types@0.10.19/lib/object.d.ts
|
|
204
204
|
|
|
205
205
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
206
206
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -991,24 +991,23 @@ function asFunction(value, sync = true) {
|
|
|
991
991
|
}
|
|
992
992
|
return null;
|
|
993
993
|
}
|
|
994
|
-
function getEncoding(value, fallback
|
|
994
|
+
function getEncoding(value, fallback) {
|
|
995
995
|
if (typeof value === 'string') {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
return 'utf16le';
|
|
996
|
+
const result = value.trim().toLowerCase();
|
|
997
|
+
if (result.slice(0, 3) === 'utf') {
|
|
998
|
+
switch (result.slice(result[3] === '-' ? 4 : 3)) {
|
|
999
|
+
case '8':
|
|
1000
|
+
return 'utf-8';
|
|
1001
|
+
case '16le':
|
|
1002
|
+
case '16':
|
|
1003
|
+
return 'utf16le';
|
|
1004
|
+
}
|
|
1006
1005
|
}
|
|
1007
|
-
if (Buffer.isEncoding(
|
|
1008
|
-
return
|
|
1006
|
+
else if (Buffer.isEncoding(result)) {
|
|
1007
|
+
return result;
|
|
1009
1008
|
}
|
|
1010
1009
|
}
|
|
1011
|
-
return fallback;
|
|
1010
|
+
return fallback || 'utf-8';
|
|
1012
1011
|
}
|
|
1013
1012
|
function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
|
|
1014
1013
|
if (checkCipherType(algorithm) && isString(data)) {
|