forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UUID.d.ts
83 lines (69 loc) · 2.21 KB
/
UUID.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
// Type definitions for UUID.js v3.3.0
// Project: https://github.com/LiosK/UUID.js
// Definitions by: Jason Jarrett <https://github.com/staxmanade/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "UUID" {
interface UUID {
intFields: UUIDArray<number>;
bitFields: UUIDArray<string>;
hexFields: UUIDArray<string>;
version: number;
bitString: string;
hexString: string;
urn: string;
/**
* Tests if two {@link UUID} objects are equal.
* @param {UUID} uuid
* @returns {bool} True if two {@link UUID} objects are equal.
*/
equals(uuid:UUID): boolean;
/**
* Returns UUID string representation.
* @returns {string} {@link UUID#hexString}.
*/
toString(): string;
}
interface UUIDArray<T> extends Array<T> {
timeLow: string;
timeMid: string;
timeHiAndVersion: string;
clockSeqHiAndReserved: string;
clockSeqLow: string;
node: string;
}
/**
* The simplest function to get an UUID string.
* @returns {string} A version 4 UUID string.
*/
export function generate(): string;
/**
* Generates a version 4 {@link UUID}.
* @returns {UUID} A version 4 {@link UUID} object.
* @since 3.0
*/
export function genV4(): UUID;
/**
* Generates a version 1 {@link UUID}.
* @returns {UUID} A version 1 {@link UUID} object.
* @since 3.0
*/
export function genV1(): UUID;
/**
* Converts hexadecimal UUID string to an {@link UUID} object.
* @param {string} uuid UUID hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
* @returns {UUID} {@link UUID} object or null.
* @since 3.0
*/
export function parse(uuid:string): UUID;
/**
* Re-initializes version 1 UUID state.
* @since 3.0
*/
export function resetState(): void;
/**
* Reinstalls {@link UUID.generate} method to emulate the interface of UUID.js version 2.x.
* @since 3.1
* @deprecated Version 2.x. compatible interface is not recommended.
*/
export function makeBackwardCompatible(): void;
}