-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
93 lines (79 loc) · 2.85 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Type definitions for kuuid
// Project: https://github.com/glynnbird/kuuid
// Definitions by: Glynn Bird <https://github.com/glynnbird>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare namespace kuuid {
interface IDOpts {
/** The timestamp used to generate the id. Either an ISO string or number of milliseconds
* since 1970. Default: undefined, which
*/
timestamp?: string | number | undefined;
/** The amount of random data to append to the time portion of the id. A number
* between 1 and 4. Default: 4.
*/
random?: number;
/** Whether to generate the id in oldest-first order (false) or newest-first order (true).
* Default: false
*/
reverse?: boolean;
/** Whether to generate the id to second precision (false) or millisecond precision (true).
* Default: false
*/
millsecond?: false;
}
/**
* Generate the 8-character prefix
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 8-character prefix string
*/
function prefix(opts?: IDOpts | string | number): string;
/**
* Generate the 8-character prefix - reverse mode
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 8-character prefix string
*/
function prefixr(t?: string | number): string;
/**
* Generate the 8-character prefix - ms mode
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 8-character prefix string
*/
function prefixms(t?: string | number): string;
/**
* Generate 128-bits of random date encoded as 24 character string
* @return 24-character prefix string
*/
function rand(): string;
/**
* Generate a date/time sortable 32 character unique identifier
* @param t ISO-8601 date string or number of milliseconds since 1970 or options
* @return 32-character id
*/
function id(opts?: IDOpts | string | number): string;
/**
* Generate a reverse date/time sortable 32 character unique identifier
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 32-character id
*/
function idr(t?: string | number): string;
/**
* Generate short a date/time sortable 32 character unique identifier
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 32-character id
*/
function ids(t?: string | number): string;
/**
* Generate short a reverse date/time sortable 32 character unique identifier
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 32-character id
*/
function idsr(t?: string | number): string;
/**
* Generate a millisecond, time sortable 32 character unique identifier
* @param t ISO-8601 date string or number of milliseconds since 1970
* @return 32-character id
*/
function idms(t?: string | number): string;
}
export = kuuid