UNPKG

3.26 kBTypeScriptView Raw
1/**
2 * Random generator for various text values like names, addresses or phone numbers.
3 *
4 * ### Example ###
5 *
6 * let value1 = RandomText.name(); // Possible result: "Segio"
7 * let value2 = RandomText.verb(); // Possible result: "Run"
8 * let value3 = RandomText.Text(50); // Possible result: "Run jorge. Red high scream?"
9 */
10export declare class RandomText {
11 private static readonly _namePrefixes;
12 private static readonly _nameSuffixes;
13 private static readonly _firstNames;
14 private static readonly _lastNames;
15 private static readonly _colors;
16 private static readonly _stuffs;
17 private static readonly _adjectives;
18 private static readonly _verbs;
19 private static readonly _allWords;
20 /**
21 * Generates a random color name.
22 * The result value is capitalized.
23 *
24 * @returns a random color name.
25 */
26 static color(): string;
27 /**
28 * Generates a random noun.
29 * The result value is capitalized.
30 *
31 * @returns a random noun.
32 */
33 static noun(): string;
34 /**
35 * Generates a random adjective.
36 * The result value is capitalized.
37 *
38 * @returns a random adjective.
39 */
40 static adjective(): string;
41 /**
42 * Generates a random verb.
43 * The result value is capitalized.
44 *
45 * @returns a random verb.
46 */
47 static verb(): string;
48 /**
49 * Generates a random phrase which consists of few words separated by spaces.
50 * The first word is capitalized, others are not.
51 *
52 * @param minLength (optional) minimum string length.
53 * @param maxLength maximum string length.
54 * @returns a random phrase.
55 */
56 static phrase(minLength: number, maxLength?: number): string;
57 /**
58 * Generates a random person's name which has the following structure
59 * <optional prefix> <first name> <second name> <optional suffix>
60 *
61 * @returns a random name.
62 */
63 static fullName(): string;
64 /**
65 * Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.
66 *
67 * @returns a random word.
68 */
69 static word(): string;
70 /**
71 * Generates a random text that consists of random number of random words separated by spaces.
72 *
73 * @param min (optional) a minimum number of words.
74 * @param max a maximum number of words.
75 * @returns a random text.
76 */
77 static words(min: number, max?: number): string;
78 /**
79 * Generates a random phone number.
80 * The phone number has the format: (XXX) XXX-YYYY
81 *
82 * @returns a random phone number.
83 */
84 static phone(): string;
85 /**
86 * Generates a random email address.
87 *
88 * @returns a random email address.
89 */
90 static email(): string;
91 /**
92 * Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.
93 *
94 * @param minLength minimum amount of words to generate. Text will contain 'minSize' words if 'maxSize' is omitted.
95 * @param maxLength (optional) maximum amount of words to generate.
96 * @returns a random text.
97 */
98 static text(minLength: number, maxLength?: number): string;
99}