@e-mc/types 0.11.9 → 0.11.10
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 +7 -10
- 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.11.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.11.10/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -198,10 +198,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
198
198
|
|
|
199
199
|
## References
|
|
200
200
|
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
203
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
204
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.11.10/index.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.11.10/lib/logger.d.ts
|
|
203
|
+
- https://www.unpkg.com/@e-mc/types@0.11.10/lib/module.d.ts
|
|
204
|
+
- https://www.unpkg.com/@e-mc/types@0.11.10/lib/node.d.ts
|
|
205
205
|
|
|
206
206
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
207
207
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -584,18 +584,15 @@ function parseTime(value, start = 0) {
|
|
|
584
584
|
const seconds = +value;
|
|
585
585
|
if (isNaN(seconds) && isString(value)) {
|
|
586
586
|
let result = 0;
|
|
587
|
-
for (const match of value.
|
|
587
|
+
for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
|
|
588
588
|
const n = +match[1];
|
|
589
589
|
if (isNaN(n)) {
|
|
590
590
|
continue;
|
|
591
591
|
}
|
|
592
|
-
switch (match[2]) {
|
|
592
|
+
switch (match[2].toLowerCase()) {
|
|
593
593
|
case 'y':
|
|
594
594
|
result += n * 31449600000;
|
|
595
595
|
break;
|
|
596
|
-
case 'M':
|
|
597
|
-
result += n * 2592000000;
|
|
598
|
-
break;
|
|
599
596
|
case 'w':
|
|
600
597
|
result += n * 604800000;
|
|
601
598
|
break;
|
|
@@ -605,15 +602,15 @@ function parseTime(value, start = 0) {
|
|
|
605
602
|
case 'h':
|
|
606
603
|
result += n * 3600000;
|
|
607
604
|
break;
|
|
608
|
-
case 'm':
|
|
609
|
-
result += n * 60000;
|
|
610
|
-
break;
|
|
611
605
|
case 's':
|
|
612
606
|
result += n * 1000;
|
|
613
607
|
break;
|
|
614
608
|
case 'ms':
|
|
615
609
|
result += Math.ceil(n);
|
|
616
610
|
break;
|
|
611
|
+
default:
|
|
612
|
+
result += n * (match[2] === 'M' ? 2592000000 : 60000);
|
|
613
|
+
break;
|
|
617
614
|
}
|
|
618
615
|
}
|
|
619
616
|
if (result > 0) {
|
|
@@ -648,10 +645,10 @@ function formatTime(value, elapsed, char = ' ') {
|
|
|
648
645
|
if (value >= 60000) {
|
|
649
646
|
const m = Math.floor(value / 60000);
|
|
650
647
|
value -= m * 60000;
|
|
651
|
-
result += padStart(m,
|
|
648
|
+
result += (result ? padStart(m, '0') : m) + ':';
|
|
652
649
|
}
|
|
653
650
|
else {
|
|
654
|
-
result += '0:';
|
|
651
|
+
result += result ? '00:' : '0:';
|
|
655
652
|
}
|
|
656
653
|
if (value >= 1000) {
|
|
657
654
|
const s = Math.floor(value / 1000);
|
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
|
}
|