@e-mc/types 0.10.13 → 0.10.15
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.10.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.15/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -197,10 +197,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
197
197
|
|
|
198
198
|
## References
|
|
199
199
|
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
203
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.10.15/index.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.10.15/lib/logger.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.10.15/lib/module.d.ts
|
|
203
|
+
- https://www.unpkg.com/@e-mc/types@0.10.15/lib/object.d.ts
|
|
204
204
|
|
|
205
205
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
206
206
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -639,18 +639,15 @@ function parseTime(value, start = 0) {
|
|
|
639
639
|
const seconds = +value;
|
|
640
640
|
if (isNaN(seconds) && isString(value)) {
|
|
641
641
|
let result = 0;
|
|
642
|
-
for (const match of value.
|
|
642
|
+
for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
|
|
643
643
|
const n = +match[1];
|
|
644
644
|
if (isNaN(n)) {
|
|
645
645
|
continue;
|
|
646
646
|
}
|
|
647
|
-
switch (match[2]) {
|
|
647
|
+
switch (match[2].toLowerCase()) {
|
|
648
648
|
case 'y':
|
|
649
649
|
result += n * 31449600000;
|
|
650
650
|
break;
|
|
651
|
-
case 'M':
|
|
652
|
-
result += n * 2592000000;
|
|
653
|
-
break;
|
|
654
651
|
case 'w':
|
|
655
652
|
result += n * 604800000;
|
|
656
653
|
break;
|
|
@@ -660,15 +657,15 @@ function parseTime(value, start = 0) {
|
|
|
660
657
|
case 'h':
|
|
661
658
|
result += n * 3600000;
|
|
662
659
|
break;
|
|
663
|
-
case 'm':
|
|
664
|
-
result += n * 60000;
|
|
665
|
-
break;
|
|
666
660
|
case 's':
|
|
667
661
|
result += n * 1000;
|
|
668
662
|
break;
|
|
669
663
|
case 'ms':
|
|
670
664
|
result += Math.ceil(n);
|
|
671
665
|
break;
|
|
666
|
+
default:
|
|
667
|
+
result += n * (match[2] === 'M' ? 2592000000 : 60000);
|
|
668
|
+
break;
|
|
672
669
|
}
|
|
673
670
|
}
|
|
674
671
|
if (result > 0) {
|
|
@@ -703,10 +700,10 @@ function formatTime(value, elapsed, char = ' ') {
|
|
|
703
700
|
if (value >= 60000) {
|
|
704
701
|
const m = Math.floor(value / 60000);
|
|
705
702
|
value -= m * 60000;
|
|
706
|
-
result += padStart(m,
|
|
703
|
+
result += (result ? padStart(m, '0') : m) + ':';
|
|
707
704
|
}
|
|
708
705
|
else {
|
|
709
|
-
result += '0:';
|
|
706
|
+
result += result ? '00:' : '0:';
|
|
710
707
|
}
|
|
711
708
|
if (value >= 1000) {
|
|
712
709
|
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
|
}
|