@e-mc/types 0.8.26 → 0.8.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
- - https://www.unpkg.com/@e-mc/types@0.8.26/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.28/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.26/lib/logger.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/module.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.8.28/lib/logger.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.8.28/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
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.8.26',
2
+ VERSION = '0.8.28',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -62,6 +62,7 @@ export const enum ERR_MESSAGE {
62
62
  UNSUPPORTED_MIME = 'Unsupported MIME',
63
63
  UNSUPPORTED_READ = 'Not permitted to read file',
64
64
  UNSUPPORTED_WRITE = 'Not permitted to write file',
65
+ UNSUPPORTED_PATH = 'Not permitted to set absolute path',
65
66
  NOTFOUND_FILE = 'File not found',
66
67
  NOTFOUND_BINARY = 'Binary not found',
67
68
  NOTFOUND_PACKAGE = 'Package not found',
package/index.js CHANGED
@@ -424,20 +424,16 @@ exports.isEmpty = isEmpty;
424
424
  function parseTime(value, start = 0) {
425
425
  const seconds = +value;
426
426
  if (isNaN(seconds) && isString(value)) {
427
- const pattern = /\b([\d.]+)\s*(y|M|w|d|h|ms?|s)\b/g;
428
- let result = 0, match = null;
429
- while (match = pattern.exec(value.toLowerCase())) {
427
+ let result = 0;
428
+ for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
430
429
  const n = +match[1];
431
430
  if (isNaN(n)) {
432
431
  continue;
433
432
  }
434
- switch (match[2]) {
433
+ switch (match[2].toLowerCase()) {
435
434
  case 'y':
436
435
  result += n * 31449600000;
437
436
  break;
438
- case 'M':
439
- result += n * 2592000000;
440
- break;
441
437
  case 'w':
442
438
  result += n * 604800000;
443
439
  break;
@@ -447,15 +443,15 @@ function parseTime(value, start = 0) {
447
443
  case 'h':
448
444
  result += n * 3600000;
449
445
  break;
450
- case 'm':
451
- result += n * 60000;
452
- break;
453
446
  case 's':
454
447
  result += n * 1000;
455
448
  break;
456
449
  case 'ms':
457
450
  result += Math.ceil(n);
458
451
  break;
452
+ default:
453
+ result += n * (match[2] === 'M' ? 2592000000 : 60000);
454
+ break;
459
455
  }
460
456
  }
461
457
  if (result > 0) {
package/lib/index.d.ts CHANGED
@@ -555,7 +555,7 @@ declare namespace functions {
555
555
  getThreadCount(full: true): ThreadCountStat;
556
556
  getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
557
557
  getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
558
- getPermissionFromSettings(): IPermission;
558
+ getPermissionFromSettings(freeze?: boolean): IPermission;
559
559
  readonly prototype: IHost;
560
560
  new(config?: HostInitConfig): IHost;
561
561
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.8.26",
3
+ "version": "0.8.28",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",