forked from sindresorhus/to-milliseconds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
41 lines (35 loc) · 837 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
declare namespace toMilliseconds {
interface TimeDescriptor {
readonly days?: number;
readonly hours?: number;
readonly minutes?: number;
readonly seconds?: number;
readonly milliseconds?: number;
readonly microseconds?: number;
readonly nanoseconds?: number;
}
}
declare const toMilliseconds: {
/**
Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`.
@example
```
import toMilliseconds = require('@sindresorhus/to-milliseconds');
toMilliseconds({
days: 15,
hours: 11,
minutes: 23,
seconds: 20,
milliseconds: 1
});
//=> 1337000001
setTimeout(() => {
// …
}, toMilliseconds({minutes: 2}));
```
*/
(timeDescriptor: toMilliseconds.TimeDescriptor): number;
// TODO: remove this for next major version
default: typeof toMilliseconds;
};
export = toMilliseconds;