-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
293 lines (269 loc) · 8.12 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/**
* Contains all hex colors starting with #
* @module colorHashtag
* @param {string} colorHashtag.Color
* @example
* console.log(colorHashtag.Red)
* @returns {string} String
*/
module colorHashtag {}
/**
* Contains all hex colors starting with 0x
* @module colorZero
* @param {string} colorZero.Color
* @example
* console.log(colorZero.Red)
* @returns {string} String
*/
module colorZero {}
/**
* Contains the colors for the log section
* @module listLogColor
* @param {string} listLogColor.Color
* @deprecated Use logColor
* @example
* log('Something', listLogColor.FgRed)
* @returns {string} String
*/
module listLogColor {}
/**
* Contains the colors for the log section
* @module logColor
* @param {string} logColor.Color
* @example
* log('Something', logColor.FgRed)
* @returns {string} String
*/
module logColor {}
/**
* Generates a random captcha string with the specified length.
* @param {number} [captchaLength=5] - The length of the captcha string to generate (defaults to 5).
* @example
* console.log(generateCaptcha(number))
* @returns {string} The generated captcha string.
*/
export function generateCaptcha(captchaLength?: number): string;
/**
* Generates a unique key with the specified prefix.
* @param {string} [prefix] - The prefix to use for the key (defaults to "PREFIX").
* @example
* console.log(generateKey('PREFIX'))
* @returns {string} The generated key.
*/
export function generateKey(prefix?: string): string;
/**
* Generates a random password of the specified length using specified character sets.
* @param {number} [length=10] - The length of the password to generate.
* @param {Object} [options] - Options to specify character sets and their required usage.
* @param {Object} [options.special] - Include special characters with times to force.
* @param {Object} [options.chinese] - Include Chinese characters with times to force.
* @param {Object} [options.japanese] - Include Japanese characters with times to force.
* @param {Object} [options.arabic] - Include Arabic characters with times to force.
* @param {Object} [options.rongoRongo] - Include Rongo Rongo characters with times to force.
* @param {Object} [options.cyrillic] - Include Cyrillic characters with times to force.
* @param {Object} [options.greek] - Include Greek characters with times to force.
* @param {Object} [options.hebrew] - Include Hebrew characters with times to force.
* @example
* console.log(generatePassword(10, { chinese: { active: true, times: 2 }, japanese: { active: true, times: 1 } }))
* @returns {string} The generated password.
*/
export function generatePassword(length?: number, options?: {
special?: {
active?: boolean;
times?: number;
};
chinese?: {
active?: boolean;
times?: number;
};
japanese?: {
active?: boolean;
times?: number;
};
arabic?: {
active?: boolean;
times?: number;
};
rongoRongo?: {
active?: boolean;
times?: number;
};
cyrillic?: {
active?: boolean;
times?: number;
};
greek?: {
active?: boolean;
times?: number;
};
hebrew?: {
active?: boolean;
times?: number;
};
}): string;
/**
* Formats a number to a string with thousand separators.
* @param {number} number - The number to format.
* @example
* console.log(formats.Number(10000))
* @returns {string} The formatted string.
*/
export function Number(number: number): string;
/**
* Formats a string to title case.
* @param {string} str - The string to format.
* console.log(formats.TitleCase("Example of text"))
* @returns {string} The formatted string.
*/
export function TitleCase(str: string): string;
/**
* Formats a string to sentence case.
* @param {string} str - The string to format.
* console.log(formats.SentenceCase("Example Of Text"))
* @returns {string} The formatted string.
*/
export function SentenceCase(str: string): string;
/**
* Formats a string to camel case.
* @param {string} str - The string to format.
* console.log(formats.CamelCase("Example of text"))
* @returns {string} The formatted string.
*/
export function CamelCase(str: string): string;
/**
* Formats a string to kebab case.
* @param {string} str - The string to format.
* console.log(formats.KebabCase("Example of text"))
* @returns {string} The formatted string.
*/
export function KebabCase(str: string): string;
/**
* Formats a string to snake case.
* @param {string} str - The string to format.
* console.log(formats.SnakeCase("Example of text"))
* @returns {string} The formatted string.
*/
export function SnakeCase(str: string): string;
/**
* Formats a date as a string with a customizable order of day, month and year.
* @param {Date} date - The date to format.
* @param {string} [order="dmy"] - The order in which to display the day, month and year.
* Can be "dmy", "mdy", "ymd", "ydm", "myd" or "dym".
* @example
* console.log(formats.DateFor(new Date(), "dmy"))
* console.log(formats.DateFor(new Date(), "mdy"))
* console.log(formats.DateFor(new Date(), "ymd"))
* console.log(formats.DateFor(new Date(), "ydm"))
* console.log(formats.DateFor(new Date(), "myd"))
* console.log(formats.DateFor(new Date(), "dym"))
* @returns {string} A string representation of the date.
*/
export function DateFor(date: Date, order?: string): string;
/**
* Make a log with or without color
* @param {string} text
* @param {string} color
* @example
* log('Something')
* log('Something', logColor.FgRed)
* @returns {void} void
*/
export function log(text: string, color: string): void;
/**
* Converts the indicated time to milliseconds
* @param {string} ms
* @example
* console.log(millisecond('1000 ms'))
* console.log(millisecond('1 s'))
* console.log(millisecond('1 m'))
* console.log(millisecond('1 h'))
* console.log(millisecond('1 d'))
* console.log(millisecond('1 w'))
* console.log(millisecond('1 y'))
* @returns {number} Number
*/
export function millisecond(ms: string): number;
/**
* Get a random number between 2 numbers
* @param {number} min
* @param {number} max
* @example
* console.log(random(1, 10))
* @returns {number} Number
*/
export function random(min: number, max: number): number;
/**
* Get a random element from an array
* @param {Array} items
* @example
* console.log(randomItem(['a', 'b', 'c']))
* @returns {string} String
*/
export function randomItem(items: Array): string;
/**
* Returns a selected symbol
* @module colorZero
* @param {string} symbols.Symbol
* @example
* console.log(symbols.tick)
* @returns {string} String
*/
module colorZero {}
/**
* Check what type is provided
* @param {any} obj
* @example
* console.log(type(null))
* console.log(type(undefined))
* console.log(type(5))
* console.log(type(true))
* console.log(type('str'))
* @returns {string} String
*/
export function type(obj: any): string;
/**
* A function that returns a promise that resolves after a specified delay.
* @module wait
* @param {number} [delay=0] - The delay, in milliseconds, before the promise should resolve.
* @example
* async function async() {
* await wait(2000)
* console.log("Something")
* }
* async()
* @returns {Promise<void>} - A promise that resolves after the specified delay.
*/
module wait {}
/**
* Check if the text is not empty
* @param {string} value
* @example
* console.log(isEmptyString('Something'))
* @returns {boolean} Boolean
*/
export function isEmptyString(value: string): boolean;
/**
* Check if it is a email
* @param {string} email
* @example
* console.log(isValidEmail('[email protected]'))
* @returns {boolean} Boolean
*/
export function isValidEmail(email: string): boolean;
/**
* Check if it is a number
* @param {number} number
* @example
* console.log(isValidNumber(number))
* @returns {boolean} Boolean
*/
export function isValidNumber(number: number): boolean;
/**
* Check that the text is a link | Only texts with http: or https:
* @param {string} content
* @param {Array} whitelist
* @example
* console.log(isValidUrl('https://google.com'))
* @returns {boolean} Boolean
*/
export function isValidUrl(content: string, whitelist: Array): boolean;