@e-mc/types 0.8.27 → 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 +3 -3
- package/constant.d.ts +1 -1
- package/index.js +6 -10
- package/lib/index.d.ts +1 -1
- package/lib/task.d.ts +9 -9
- 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.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.
|
|
190
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
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
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
|
-
|
|
428
|
-
|
|
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/lib/task.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface Command<T = unknown> extends PlainObject {
|
|
2
|
-
task: string;
|
|
3
|
-
origDir: string;
|
|
4
|
-
data: T;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface SpawnResult {
|
|
8
|
-
added?: string[];
|
|
9
|
-
deleted?: string[];
|
|
1
|
+
export interface Command<T = unknown> extends PlainObject {
|
|
2
|
+
task: string;
|
|
3
|
+
origDir: string;
|
|
4
|
+
data: T;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SpawnResult {
|
|
8
|
+
added?: string[];
|
|
9
|
+
deleted?: string[];
|
|
10
10
|
}
|