-
-
Notifications
You must be signed in to change notification settings - Fork 154
/
IRandomGenerator.ts
62 lines (54 loc) · 1.35 KB
/
IRandomGenerator.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
import { Customizable } from "./typings/Customizable";
export interface IRandomGenerator {
// REGULAR
boolean(): boolean;
integer(minimum?: number, maximum?: number): number;
bigint(minimum?: bigint, maximum?: bigint): bigint;
number(minimum?: number, maximum?: number): number;
string(length?: number): string;
array<T>(closure: (index: number) => T, count?: number): T[];
length(): number;
pattern(regex: RegExp): string;
//----
// FORMAT
//----
// SPECIAL CHARACTERS
byte(): string;
password(): string;
regex(): string;
uuid(): string;
// ADDRESSES
email(): string;
hostname(): string;
idnEmail(): string;
idnHostname(): string;
iri(): string;
iriReference(): string;
ipv4(): string;
ipv6(): string;
uri(): string;
uriReference(): string;
uriTemplate(): string;
url(): string;
// TIMESTAMPS
datetime(minimum?: number, maximum?: number): string;
date(minimum?: number, maximum?: number): string;
time(): string;
duration(): string;
// POINTERS
jsonPointer(): string;
relativeJsonPointer(): string;
customs?: IRandomGenerator.CustomMap;
}
export namespace IRandomGenerator {
export type CustomMap = {
[Type in keyof Customizable]?: (
tags: ITypeTag[],
) => Customizable[Type] | undefined;
};
export interface ITypeTag {
name: string;
kind: string;
value: any;
}
}