@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 CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.9.26/index.d.ts)
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.26/lib/logger.d.ts
198
- - https://www.unpkg.com/@e-mc/types@0.9.26/lib/module.d.ts
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
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.9.26',
2
+ VERSION = '0.9.28',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
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 = 'utf-8') {
925
+ function getEncoding(value, fallback) {
926
926
  if (typeof value === 'string') {
927
- switch (value = value.trim().toLowerCase()) {
928
- case 'utf8':
929
- case 'utf-8':
930
- case 'utf16le':
931
- return value;
932
- case 'utf-16le':
933
- case 'utf16':
934
- case 'utf-16':
935
- return 'utf16le';
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(value)) {
938
- return value;
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
@@ -0,0 +1,9 @@
1
+ interface EventListenerOptions {
2
+ capture?: boolean;
3
+ }
4
+
5
+ export interface AddEventListenerOptions extends EventListenerOptions {
6
+ once?: boolean;
7
+ passive?: boolean;
8
+ signal?: AbortSignal;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.9.26",
3
+ "version": "0.9.28",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",