-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathindex.d.ts
162 lines (158 loc) · 3.7 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/**
* @property text : text
*
* @Cow
* @property f : cow name
* @property r : random selection
*
* @Face
* @property T : Tongue
* @property e : eyes
*
* @Modes
* @property b : borg
* @property d : dead
* @property g : greedy
* @property p : paranoia
* @property s : stoned
* @property t : tired
* @property w : wired
* @property y : youthful
*/
export interface IOptions {
text: string,
// cow
f?: string, // cow name
r?: boolean, // random mode
// face
e?: string, // eyes
T?: string, // tongue
// modes
b?: boolean, // borg
d?: boolean, // dead
g?: boolean, // greedy
p?: boolean, // paranoia
s?: boolean, // stoned
t?: boolean, // tired
w?: boolean, // wired
y?: boolean, // youthful
}
type callback_type = (error: NodeJS.ErrnoException, cow_names: string[]) => void;
/**
* @param callback
* @returns a list of cow names from the cows folder without the .cow extension.
* @example
* ```
* function get_cows(error: NodeJS.ErrnoException, cow_names: Array<string>): void {
* if (error) {
* console.log(`Error getting cow names: ${error.message}`);
* }
* else if (cow_names) {
* console.log(`Number of cows available: ${cow_names.length}`);
* }
* }
*
* cowsay.list(get_cows);
* ```
*/
export function list(callback: callback_type): Promise<string[]>;
/**
* @param options
* ## Face :
* Either choose a mode (set the value as true) **_or_**
* set your own defined eyes and tongue to `e` and `T`.
* - ### `e` : eyes
* - ### `T` : tongue
*
* ## Cow :
* Either specify a cow name (e.g. "fox") **_or_**
* set the value of `r` to true which selects a random cow.
* - ### `r` : random selection
* - ### `f` : cow name - from `cows` folder
*
* ## Modes :
* Modes are just ready-to-use faces, here's their list:
* - #### `b` : borg
* - #### `d` : dead
* - #### `g` : greedy
* - #### `p` : paranoia
* - #### `s` : stoned
* - #### `t` : tired
* - #### `w` : wired
* - #### `y` : youthful
*
* @example
* ```
* // custom cow and face
* cowsay.say({
* text: 'Hello world!',
* e: '^^', // eyes
* T: 'U ', // tongue
* f: 'USA' // name of the cow from `cows` folder
* })
*
* // using a random cow
* cowsay.say({
* text: 'Hello world!',
* e: 'xx', // eyes
* r: true, // random mode - use a random cow.
* })
*
* // using a mode
* cowsay.say({
* text: 'Hello world!',
* y: true, // using y mode - youthful mode
* })
* ```
*/
export function say(options: IOptions): string;
/**
* @param options
* ## Face :
* Either choose a mode (set the value as true) **_or_**
* set your own defined eyes and tongue to `e` and `T`.
* - ### `e` : eyes
* - ### `T` : tongue
*
* ## Cow :
* Either specify a cow name (e.g. "fox") **_or_**
* set the value of `r` to true which selects a random cow.
* - ### `r` : random selection
* - ### `f` : cow name - from `cows` folder
*
* ## Modes :
* Modes are just ready-to-use faces, here's their list:
* - #### `b` : borg
* - #### `d` : dead
* - #### `g` : greedy
* - #### `p` : paranoia
* - #### `s` : stoned
* - #### `t` : tired
* - #### `w` : youthful
* - #### `y` : wired
*
* @example
* ```
* // custom cow and face
* cowsay.think({
* text: 'Hello world!',
* e: '^^', // eyes
* T: 'U ', // tongue
* f: 'USA' // name of the cow from `cows` folder
* })
*
* // using a random cow
* cowsay.think({
* text: 'Hello world!',
* e: 'xx', // eyes
* r: true, // random mode - use a random cow.
* })
*
* // using a mode
* cowsay.think({
* text: 'Hello world!',
* y: true, // using y mode - youthful mode
* })
* ```
*/
export function think(options: IOptions): string;