1 | /**
|
2 | * Short/Long format for `value`.
|
3 | *
|
4 | * @param {Number} value
|
5 | * @param {{long: boolean}} options
|
6 | * @return {String}
|
7 | */
|
8 | declare function ms(value: number, options?: { long: boolean }): string;
|
9 |
|
10 | /**
|
11 | * Parse the given `value` and return milliseconds.
|
12 | *
|
13 | * @param {ms.StringValue} value
|
14 | * @return {Number}
|
15 | */
|
16 | declare function ms(value: ms.StringValue): number;
|
17 |
|
18 | declare namespace ms {
|
19 | // Unit, UnitAnyCase, and StringValue are backported from ms@3
|
20 | // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts
|
21 |
|
22 | type Unit =
|
23 | | "Years"
|
24 | | "Year"
|
25 | | "Yrs"
|
26 | | "Yr"
|
27 | | "Y"
|
28 | | "Weeks"
|
29 | | "Week"
|
30 | | "W"
|
31 | | "Days"
|
32 | | "Day"
|
33 | | "D"
|
34 | | "Hours"
|
35 | | "Hour"
|
36 | | "Hrs"
|
37 | | "Hr"
|
38 | | "H"
|
39 | | "Minutes"
|
40 | | "Minute"
|
41 | | "Mins"
|
42 | | "Min"
|
43 | | "M"
|
44 | | "Seconds"
|
45 | | "Second"
|
46 | | "Secs"
|
47 | | "Sec"
|
48 | | "s"
|
49 | | "Milliseconds"
|
50 | | "Millisecond"
|
51 | | "Msecs"
|
52 | | "Msec"
|
53 | | "Ms";
|
54 |
|
55 | type UnitAnyCase = Unit | Uppercase<Unit> | Lowercase<Unit>;
|
56 |
|
57 | type StringValue =
|
58 | | `${number}`
|
59 | | `${number}${UnitAnyCase}`
|
60 | | `${number} ${UnitAnyCase}`;
|
61 | }
|
62 |
|
63 | export = ms;
|