@e-mc/types 0.9.21 → 0.9.22
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 +5 -8
- 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
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.22/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.22/lib/logger.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.9.22/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
|
@@ -495,18 +495,15 @@ function parseTime(value, start = 0) {
|
|
|
495
495
|
const seconds = +value;
|
|
496
496
|
if (isNaN(seconds) && isString(value)) {
|
|
497
497
|
let result = 0;
|
|
498
|
-
for (const match of value.
|
|
498
|
+
for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
|
|
499
499
|
const n = +match[1];
|
|
500
500
|
if (isNaN(n)) {
|
|
501
501
|
continue;
|
|
502
502
|
}
|
|
503
|
-
switch (match[2]) {
|
|
503
|
+
switch (match[2].toLowerCase()) {
|
|
504
504
|
case 'y':
|
|
505
505
|
result += n * 31449600000;
|
|
506
506
|
break;
|
|
507
|
-
case 'M':
|
|
508
|
-
result += n * 2592000000;
|
|
509
|
-
break;
|
|
510
507
|
case 'w':
|
|
511
508
|
result += n * 604800000;
|
|
512
509
|
break;
|
|
@@ -516,15 +513,15 @@ function parseTime(value, start = 0) {
|
|
|
516
513
|
case 'h':
|
|
517
514
|
result += n * 3600000;
|
|
518
515
|
break;
|
|
519
|
-
case 'm':
|
|
520
|
-
result += n * 60000;
|
|
521
|
-
break;
|
|
522
516
|
case 's':
|
|
523
517
|
result += n * 1000;
|
|
524
518
|
break;
|
|
525
519
|
case 'ms':
|
|
526
520
|
result += Math.ceil(n);
|
|
527
521
|
break;
|
|
522
|
+
default:
|
|
523
|
+
result += n * (match[2] === 'M' ? 2592000000 : 60000);
|
|
524
|
+
break;
|
|
528
525
|
}
|
|
529
526
|
}
|
|
530
527
|
if (result > 0) {
|
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
|
}
|