@ix-xs/node-comfort 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +623 -748
- package/index.js +39 -13
- package/package.json +74 -24
- package/src/Arr.js +433 -0
- package/src/Checker.js +547 -188
- package/src/FS.js +127 -1
- package/src/Func.js +375 -0
- package/src/Id.js +235 -0
- package/src/Logger.js +71 -0
- package/src/Num.js +366 -0
- package/src/Obj.js +421 -0
- package/src/SQLite.js +20 -9
- package/src/Str.js +452 -0
- package/src/Time.js +485 -0
- package/types/index.d.ts +526 -0
- package/types/index.d.ts.map +1 -0
- package/types/src/Arr.d.ts +252 -0
- package/types/src/Arr.d.ts.map +1 -0
- package/types/src/Checker.d.ts +407 -0
- package/types/src/Checker.d.ts.map +1 -0
- package/types/src/FS.d.ts +303 -0
- package/types/src/FS.d.ts.map +1 -0
- package/types/src/Func.d.ts +210 -0
- package/types/src/Func.d.ts.map +1 -0
- package/types/src/Id.d.ts +119 -0
- package/types/src/Id.d.ts.map +1 -0
- package/types/src/Logger.d.ts +68 -0
- package/types/src/Logger.d.ts.map +1 -0
- package/types/src/Num.d.ts +242 -0
- package/types/src/Num.d.ts.map +1 -0
- package/types/src/Obj.d.ts +189 -0
- package/types/src/Obj.d.ts.map +1 -0
- package/types/src/SQLite.d.ts +396 -0
- package/types/src/SQLite.d.ts.map +1 -0
- package/types/src/Str.d.ts +293 -0
- package/types/src/Str.d.ts.map +1 -0
- package/types/src/Time.d.ts +205 -0
- package/types/src/Time.d.ts.map +1 -0
- package/types/src/Utils.d.ts +124 -0
- package/types/src/Utils.d.ts.map +1 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
SQLite: {
|
|
3
|
+
new (path?: string): SQLite;
|
|
4
|
+
};
|
|
5
|
+
str: {
|
|
6
|
+
capitalize(str: string): string;
|
|
7
|
+
titleCase(str: string): string;
|
|
8
|
+
camelCase(str: string): string;
|
|
9
|
+
pascalCase(str: string): string;
|
|
10
|
+
snakeCase(str: string): string;
|
|
11
|
+
kebabCase(str: string): string;
|
|
12
|
+
constantCase(str: string): string;
|
|
13
|
+
slugify(str: string, options?: {
|
|
14
|
+
separator?: string;
|
|
15
|
+
lower?: boolean;
|
|
16
|
+
}): string;
|
|
17
|
+
truncate(str: string, length: number, options?: {
|
|
18
|
+
omission?: string;
|
|
19
|
+
words?: boolean;
|
|
20
|
+
}): string;
|
|
21
|
+
padStart(str: string, length: number, char?: string): string;
|
|
22
|
+
padEnd(str: string, length: number, char?: string): string;
|
|
23
|
+
center(str: string, length: number, char?: string): string;
|
|
24
|
+
reverse(str: string): string;
|
|
25
|
+
squish(str: string): string;
|
|
26
|
+
stripTags(str: string): string;
|
|
27
|
+
escapeHTML(str: string): string;
|
|
28
|
+
unescapeHTML(str: string): string;
|
|
29
|
+
escapeRegExp(str: string): string;
|
|
30
|
+
count(str: string, sub: string): number;
|
|
31
|
+
ensurePrefix(str: string, prefix: string): string;
|
|
32
|
+
ensureSuffix(str: string, suffix: string): string;
|
|
33
|
+
removePrefix(str: string, prefix: string): string;
|
|
34
|
+
removeSuffix(str: string, suffix: string): string;
|
|
35
|
+
template(str: string, data: Record<string, any>, options?: {
|
|
36
|
+
open?: string;
|
|
37
|
+
close?: string;
|
|
38
|
+
fallback?: string;
|
|
39
|
+
}): string;
|
|
40
|
+
words(str: string): string[];
|
|
41
|
+
length(str: string): number;
|
|
42
|
+
random(length?: number, charset?: string): string;
|
|
43
|
+
};
|
|
44
|
+
num: {
|
|
45
|
+
clamp(value: number, min: number, max: number): number;
|
|
46
|
+
inRange(value: number, min: number, max: number): boolean;
|
|
47
|
+
round(value: number, decimals?: number): number;
|
|
48
|
+
floor(value: number, decimals?: number): number;
|
|
49
|
+
ceil(value: number, decimals?: number): number;
|
|
50
|
+
lerp(start: number, end: number, t: number): number;
|
|
51
|
+
mapRange(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
52
|
+
random(min?: number, max?: number): number;
|
|
53
|
+
randomInt(min: number, max: number): number;
|
|
54
|
+
sum(values: number[]): number;
|
|
55
|
+
average(values: number[]): number;
|
|
56
|
+
median(values: number[]): number;
|
|
57
|
+
min(values: number[]): number | undefined;
|
|
58
|
+
max(values: number[]): number | undefined;
|
|
59
|
+
percent(value: number, total: number, decimals?: number): number;
|
|
60
|
+
formatBytes(bytes: number, options?: {
|
|
61
|
+
decimals?: number;
|
|
62
|
+
binary?: boolean;
|
|
63
|
+
iec?: boolean;
|
|
64
|
+
}): string;
|
|
65
|
+
abbreviate(value: number, decimals?: number): string;
|
|
66
|
+
thousands(value: number, separator?: string): string;
|
|
67
|
+
ordinal(value: number): string;
|
|
68
|
+
parse(value: any, fallback?: number): number;
|
|
69
|
+
isEven(value: number): boolean;
|
|
70
|
+
isOdd(value: number): boolean;
|
|
71
|
+
range(start: number, end?: number, step?: number): number[];
|
|
72
|
+
};
|
|
73
|
+
arr: {
|
|
74
|
+
chunk(array: any[], size: number): any[][];
|
|
75
|
+
unique(array: any[], iteratee?: string | ((item: any) => any)): any[];
|
|
76
|
+
groupBy(array: any[], iteratee: string | ((item: any) => any)): Record<string, any[]>;
|
|
77
|
+
keyBy(array: any[], iteratee: string | ((item: any) => any)): Record<string, any>;
|
|
78
|
+
partition(array: any[], predicate: (item: any, index: number) => boolean): [any[], any[]];
|
|
79
|
+
flatten(array: any[], depth?: number): any[];
|
|
80
|
+
shuffle(array: any[]): any[];
|
|
81
|
+
sample(array: any[]): any;
|
|
82
|
+
sampleSize(array: any[], n: number): any[];
|
|
83
|
+
sortBy(array: any[], iteratees: string | ((item: any) => any) | Array<string | ((item: any) => any)>, direction?: "asc" | "desc"): any[];
|
|
84
|
+
difference(array: any[], ...others: any[][]): any[];
|
|
85
|
+
intersection(...arrays: any[][]): any[];
|
|
86
|
+
union(...arrays: any[][]): any[];
|
|
87
|
+
zip(...arrays: any[][]): any[][];
|
|
88
|
+
compact(array: any[]): any[];
|
|
89
|
+
first(array: any[], n?: number): any;
|
|
90
|
+
last(array: any[], n?: number): any;
|
|
91
|
+
remove(array: any[], predicate: (item: any, index: number) => boolean): any[];
|
|
92
|
+
move(array: any[], from: number, to: number): any[];
|
|
93
|
+
countBy(array: any[], iteratee?: string | ((item: any) => any)): Record<string, number>;
|
|
94
|
+
sumBy(array: any[], iteratee?: string | ((item: any) => number)): number;
|
|
95
|
+
maxBy(array: any[], iteratee?: string | ((item: any) => number)): any;
|
|
96
|
+
minBy(array: any[], iteratee?: string | ((item: any) => number)): any;
|
|
97
|
+
times(n: number, value?: any | ((index: number) => any)): any[];
|
|
98
|
+
};
|
|
99
|
+
obj: {
|
|
100
|
+
clone<T>(value: T): T;
|
|
101
|
+
merge(...sources: Record<string, any>[]): Record<string, any>;
|
|
102
|
+
equal(a: any, b: any): boolean;
|
|
103
|
+
get(object: Record<string, any>, path: string | Array<string | number>, fallback?: any): any;
|
|
104
|
+
set(object: Record<string, any>, path: string | Array<string | number>, value: any): Record<string, any>;
|
|
105
|
+
has(object: Record<string, any>, path: string | Array<string | number>): boolean;
|
|
106
|
+
pick(object: Record<string, any>, keys: string[]): Record<string, any>;
|
|
107
|
+
omit(object: Record<string, any>, keys: string[]): Record<string, any>;
|
|
108
|
+
filter(object: Record<string, any>, predicate: (value: any, key: string) => boolean): Record<string, any>;
|
|
109
|
+
mapValues(object: Record<string, any>, fn: (value: any, key: string) => any): Record<string, any>;
|
|
110
|
+
mapKeys(object: Record<string, any>, fn: (key: string, value: any) => string): Record<string, any>;
|
|
111
|
+
invert(object: Record<string, any>): Record<string, string>;
|
|
112
|
+
compact(object: Record<string, any>): Record<string, any>;
|
|
113
|
+
flatten(object: Record<string, any>, prefix?: string): Record<string, any>;
|
|
114
|
+
unflatten(object: Record<string, any>): Record<string, any>;
|
|
115
|
+
isEmpty(object: Record<string, any>): boolean;
|
|
116
|
+
deepFreeze(object: Record<string, any>): Record<string, any>;
|
|
117
|
+
};
|
|
118
|
+
func: {
|
|
119
|
+
debounce<F extends (...args: any[]) => any>(fn: F, wait: number, options?: {
|
|
120
|
+
leading?: boolean;
|
|
121
|
+
}): F & {
|
|
122
|
+
cancel: () => void;
|
|
123
|
+
flush: () => void;
|
|
124
|
+
};
|
|
125
|
+
throttle<F extends (...args: any[]) => any>(fn: F, wait: number, options?: {
|
|
126
|
+
trailing?: boolean;
|
|
127
|
+
}): F & {
|
|
128
|
+
cancel: () => void;
|
|
129
|
+
};
|
|
130
|
+
once<F extends (...args: any[]) => any>(fn: F): F;
|
|
131
|
+
memoize<F extends (...args: any[]) => any>(fn: F, resolver?: (...args: any[]) => any): F & {
|
|
132
|
+
cache: Map<any, any>;
|
|
133
|
+
};
|
|
134
|
+
retry<T>(fn: () => T | Promise<T>, options?: {
|
|
135
|
+
attempts?: number;
|
|
136
|
+
delay?: number;
|
|
137
|
+
backoff?: number;
|
|
138
|
+
maxDelay?: number;
|
|
139
|
+
shouldRetry?: (error: unknown, attempt: number) => boolean;
|
|
140
|
+
onRetry?: (error: unknown, attempt: number) => void;
|
|
141
|
+
}): Promise<T>;
|
|
142
|
+
timeout<T>(promise: Promise<T> | (() => Promise<T>), ms: number, message?: string): Promise<T>;
|
|
143
|
+
pipe(...fns: ((arg: any) => any)[]): (...args: any[]) => any;
|
|
144
|
+
compose(...fns: ((arg: any) => any)[]): (...args: any[]) => any;
|
|
145
|
+
curry(fn: (...args: any[]) => any, arity?: number): (...args: any[]) => any;
|
|
146
|
+
negate(predicate: (...args: any[]) => boolean): (...args: any[]) => boolean;
|
|
147
|
+
after<F extends (...args: any[]) => any>(n: number, fn: F): F;
|
|
148
|
+
promisify(fn: (...args: any[]) => void): (...args: any[]) => Promise<any>;
|
|
149
|
+
attempt<T>(fn: (...args: any[]) => Promise<T> | T): (...args: any[]) => Promise<[unknown, T | undefined]>;
|
|
150
|
+
};
|
|
151
|
+
time: {
|
|
152
|
+
setLocale(locale: string): TimeModule;
|
|
153
|
+
setTimezone(timeZone: string | undefined): TimeModule;
|
|
154
|
+
getConfig(): {
|
|
155
|
+
locale: string;
|
|
156
|
+
timeZone: string | undefined;
|
|
157
|
+
};
|
|
158
|
+
parseDuration(input: string | number): number | null;
|
|
159
|
+
formatDuration(ms: number, options?: {
|
|
160
|
+
long?: boolean;
|
|
161
|
+
units?: number;
|
|
162
|
+
locale?: string;
|
|
163
|
+
}): string;
|
|
164
|
+
relative(date: Date | number | string, from?: Date | number | string, options?: {
|
|
165
|
+
locale?: string;
|
|
166
|
+
numeric?: "always" | "auto";
|
|
167
|
+
}): string;
|
|
168
|
+
format(date: Date | number | string, pattern?: string, options?: {
|
|
169
|
+
locale?: string;
|
|
170
|
+
timeZone?: string;
|
|
171
|
+
}): string;
|
|
172
|
+
add(date: Date | number | string, amount: number | string, unit?: "ms" | "s" | "m" | "h" | "d" | "w"): Date;
|
|
173
|
+
subtract(date: Date | number | string, amount: number | string, unit?: "ms" | "s" | "m" | "h" | "d" | "w"): Date;
|
|
174
|
+
diff(a: Date | number | string, b: Date | number | string, unit?: "ms" | "s" | "m" | "h" | "d" | "w"): number;
|
|
175
|
+
isSameDay(a: Date | number | string, b: Date | number | string, options?: {
|
|
176
|
+
timeZone?: string;
|
|
177
|
+
}): boolean;
|
|
178
|
+
startOf(date: Date | number | string, unit: "year" | "month" | "day" | "hour" | "minute" | "second"): Date;
|
|
179
|
+
unix(): number;
|
|
180
|
+
stopwatch(): {
|
|
181
|
+
elapsed: () => number;
|
|
182
|
+
stop: (format?: boolean) => number | string;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
id: {
|
|
186
|
+
uuid(): string;
|
|
187
|
+
nano(size?: number, alphabet?: string): string;
|
|
188
|
+
ulid(time?: number): string;
|
|
189
|
+
token(bytes?: number, encoding?: "hex" | "base64" | "base64url" | "base58"): string;
|
|
190
|
+
code(length?: number, alphabet?: string): string;
|
|
191
|
+
hash(value: string | Buffer, options?: {
|
|
192
|
+
algorithm?: string;
|
|
193
|
+
encoding?: "hex" | "base64" | "base64url";
|
|
194
|
+
}): string;
|
|
195
|
+
hmac(value: string | Buffer, secret: string | Buffer, options?: {
|
|
196
|
+
algorithm?: string;
|
|
197
|
+
encoding?: "hex" | "base64" | "base64url";
|
|
198
|
+
}): string;
|
|
199
|
+
safeEqual(a: string | Buffer, b: string | Buffer): boolean;
|
|
200
|
+
seq(prefix?: string): string;
|
|
201
|
+
};
|
|
202
|
+
logger: {
|
|
203
|
+
setTimestamp(value: boolean): Logger;
|
|
204
|
+
setDelimiter(options?: {
|
|
205
|
+
open?: string | undefined;
|
|
206
|
+
close?: string | undefined;
|
|
207
|
+
}): Logger;
|
|
208
|
+
log(content: any): Logger;
|
|
209
|
+
info(content: any): Logger;
|
|
210
|
+
success(content: any): Logger;
|
|
211
|
+
warn(content: any): Logger;
|
|
212
|
+
error(content: any): Logger;
|
|
213
|
+
debug(content: any): Logger;
|
|
214
|
+
group(label: string): Logger;
|
|
215
|
+
groupEnd(): Logger;
|
|
216
|
+
};
|
|
217
|
+
fs: {
|
|
218
|
+
getEnv(value: string, envFilePath?: string): string | undefined;
|
|
219
|
+
createPath(path?: string): string;
|
|
220
|
+
getFoldersIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
221
|
+
getFolder(path?: string): string | undefined;
|
|
222
|
+
getFilesIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
223
|
+
getFile(path: string): string | undefined;
|
|
224
|
+
createFolder(path: string, force?: boolean): boolean | undefined;
|
|
225
|
+
createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean | undefined;
|
|
226
|
+
deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number | undefined;
|
|
227
|
+
deleteFolder(path: string): boolean | undefined;
|
|
228
|
+
deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number | undefined;
|
|
229
|
+
deleteFile(path: string): boolean | undefined;
|
|
230
|
+
copyFoldersIn(options: {
|
|
231
|
+
dest: string;
|
|
232
|
+
path?: string | undefined;
|
|
233
|
+
recursive?: boolean | undefined;
|
|
234
|
+
withFiles?: boolean | undefined;
|
|
235
|
+
force?: boolean | undefined;
|
|
236
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
237
|
+
}): number | undefined;
|
|
238
|
+
copyFolder(options: {
|
|
239
|
+
dest: string;
|
|
240
|
+
path?: string | undefined;
|
|
241
|
+
recursive?: boolean | undefined;
|
|
242
|
+
withFiles?: boolean | undefined;
|
|
243
|
+
force?: boolean | undefined;
|
|
244
|
+
}): boolean | undefined;
|
|
245
|
+
copyFilesIn(options: {
|
|
246
|
+
dest: string;
|
|
247
|
+
path?: string | undefined;
|
|
248
|
+
recursive?: boolean | undefined;
|
|
249
|
+
force?: boolean | undefined;
|
|
250
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
251
|
+
}): number | undefined;
|
|
252
|
+
copyFile(options: {
|
|
253
|
+
path: string;
|
|
254
|
+
dest: string;
|
|
255
|
+
force?: boolean | undefined;
|
|
256
|
+
}): boolean | undefined;
|
|
257
|
+
moveFoldersIn(options: {
|
|
258
|
+
dest: string;
|
|
259
|
+
path?: string | undefined;
|
|
260
|
+
recursive?: boolean | undefined;
|
|
261
|
+
withFiles?: boolean | undefined;
|
|
262
|
+
force?: boolean | undefined;
|
|
263
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
264
|
+
}): number | undefined;
|
|
265
|
+
moveFolder(options: {
|
|
266
|
+
path: string;
|
|
267
|
+
dest: string;
|
|
268
|
+
recursive?: boolean | undefined;
|
|
269
|
+
withFiles?: boolean | undefined;
|
|
270
|
+
force?: boolean | undefined;
|
|
271
|
+
}): boolean | undefined;
|
|
272
|
+
moveFilesIn(options: {
|
|
273
|
+
dest: string;
|
|
274
|
+
path?: string | undefined;
|
|
275
|
+
recursive?: boolean | undefined;
|
|
276
|
+
force?: boolean | undefined;
|
|
277
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
278
|
+
}): number | undefined;
|
|
279
|
+
moveFile(options: {
|
|
280
|
+
path: string;
|
|
281
|
+
dest: string;
|
|
282
|
+
force?: boolean | undefined;
|
|
283
|
+
}): boolean | undefined;
|
|
284
|
+
readFile(path: string): string | undefined;
|
|
285
|
+
readJSON<T>(path: string, fallback?: T): T | any | undefined;
|
|
286
|
+
writeJSON(path: string, data: any, options?: {
|
|
287
|
+
spaces?: number;
|
|
288
|
+
force?: boolean;
|
|
289
|
+
}): boolean;
|
|
290
|
+
appendFile(path: string, data: string): boolean;
|
|
291
|
+
exists(path: string): boolean;
|
|
292
|
+
stat(path: string): any | undefined;
|
|
293
|
+
fileSize(path: string): number | undefined;
|
|
294
|
+
hashFile(path: string, options?: {
|
|
295
|
+
algorithm?: string;
|
|
296
|
+
encoding?: "hex" | "base64" | "base64url";
|
|
297
|
+
}): string | undefined;
|
|
298
|
+
emptyFolder(path: string): boolean | undefined;
|
|
299
|
+
watch(options?: {
|
|
300
|
+
path?: string | undefined;
|
|
301
|
+
recursive?: boolean | undefined;
|
|
302
|
+
filter?: ((event: "rename" | "change", file: string) => boolean) | undefined;
|
|
303
|
+
}): {
|
|
304
|
+
on: <E extends "change" | "rename" | "all">(event: E, callback: E extends "all" ? (event: "change" | "rename", file: string) => void | Promise<void> : (file: string) => void | Promise<void>) => any;
|
|
305
|
+
stop: () => void;
|
|
306
|
+
pause: () => any;
|
|
307
|
+
resume: () => any;
|
|
308
|
+
} | undefined;
|
|
309
|
+
};
|
|
310
|
+
checker: {
|
|
311
|
+
isArray(value: any): boolean;
|
|
312
|
+
isNumber(value: any): boolean;
|
|
313
|
+
isFinite(value: any): boolean;
|
|
314
|
+
isInteger(value: any): boolean;
|
|
315
|
+
isFloat(value: any): boolean;
|
|
316
|
+
isFunction(value: any): boolean;
|
|
317
|
+
isAsyncFunction(value: any): boolean;
|
|
318
|
+
isObject(value: any): boolean;
|
|
319
|
+
isPlainObject(value: any): boolean;
|
|
320
|
+
isBoolean(value: any): boolean;
|
|
321
|
+
isString(value: any): boolean;
|
|
322
|
+
isSymbol(value: any): boolean;
|
|
323
|
+
isBigInt(value: any): boolean;
|
|
324
|
+
isUndefined(value: any): boolean;
|
|
325
|
+
isNull(value: any): boolean;
|
|
326
|
+
isNil(value: any): boolean;
|
|
327
|
+
isPrimitive(value: any): boolean;
|
|
328
|
+
isPromise(value: any): boolean;
|
|
329
|
+
isRegExp(value: any): boolean;
|
|
330
|
+
isDate(value: any): boolean;
|
|
331
|
+
isValidDate(value: any): boolean;
|
|
332
|
+
isMap(value: any): boolean;
|
|
333
|
+
isSet(value: any): boolean;
|
|
334
|
+
isWeakMap(value: any): boolean;
|
|
335
|
+
isWeakSet(value: any): boolean;
|
|
336
|
+
isIterable(value: any): boolean;
|
|
337
|
+
isBuffer(value: any): boolean;
|
|
338
|
+
isTypedArray(value: any): boolean;
|
|
339
|
+
isError(value: any): boolean;
|
|
340
|
+
isEmpty(value: any): boolean;
|
|
341
|
+
isEmail(value: any): boolean;
|
|
342
|
+
isURL(value: any, options?: {
|
|
343
|
+
protocols?: string[];
|
|
344
|
+
}): boolean;
|
|
345
|
+
isUUID(value: any): boolean;
|
|
346
|
+
isJSON(value: any): boolean;
|
|
347
|
+
isNumeric(value: any): boolean;
|
|
348
|
+
};
|
|
349
|
+
utils: {
|
|
350
|
+
wait(ms: number): Promise<void>;
|
|
351
|
+
when(predicate: boolean | Promise<boolean> | (() => boolean | Promise<boolean>), payload?: any, options?: {
|
|
352
|
+
interval?: number | undefined;
|
|
353
|
+
timeout?: number | null | undefined;
|
|
354
|
+
max?: number | null | undefined;
|
|
355
|
+
}): {
|
|
356
|
+
start: () => any;
|
|
357
|
+
stop: () => any;
|
|
358
|
+
on: <E extends "error" | "trigger" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void | Promise<void> : (payload: any) => void | Promise<void>) => any;
|
|
359
|
+
};
|
|
360
|
+
dontCrash(): {
|
|
361
|
+
on: <E extends "error" | "exit" | "sig" | "beforeExit">(event: E, handler?: (E extends "error" ? (error: Error | unknown) => void | Promise<void> : E extends "exit" ? (code: number) => void | Promise<void> : E extends "sig" ? (signal: "SIGINT" | "SIGTERM" | "SIGQUIT") => void | Promise<void> : (code: number) => void | Promise<void>)) => any;
|
|
362
|
+
};
|
|
363
|
+
JSONString(value: any): string;
|
|
364
|
+
JSONParse(value: string): any;
|
|
365
|
+
};
|
|
366
|
+
wait(ms: number): Promise<void>;
|
|
367
|
+
when(predicate: boolean | Promise<boolean> | (() => boolean | Promise<boolean>), payload?: any, options?: {
|
|
368
|
+
interval?: number | undefined;
|
|
369
|
+
timeout?: number | null | undefined;
|
|
370
|
+
max?: number | null | undefined;
|
|
371
|
+
}): {
|
|
372
|
+
start: () => any;
|
|
373
|
+
stop: () => any;
|
|
374
|
+
on: <E extends "error" | "trigger" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void | Promise<void> : (payload: any) => void | Promise<void>) => any;
|
|
375
|
+
};
|
|
376
|
+
dontCrash(): {
|
|
377
|
+
on: <E extends "error" | "exit" | "sig" | "beforeExit">(event: E, handler?: (E extends "error" ? (error: Error | unknown) => void | Promise<void> : E extends "exit" ? (code: number) => void | Promise<void> : E extends "sig" ? (signal: "SIGINT" | "SIGTERM" | "SIGQUIT") => void | Promise<void> : (code: number) => void | Promise<void>)) => any;
|
|
378
|
+
};
|
|
379
|
+
JSONString(value: any): string;
|
|
380
|
+
JSONParse(value: string): any;
|
|
381
|
+
isArray(value: any): boolean;
|
|
382
|
+
isNumber(value: any): boolean;
|
|
383
|
+
isFinite(value: any): boolean;
|
|
384
|
+
isInteger(value: any): boolean;
|
|
385
|
+
isFloat(value: any): boolean;
|
|
386
|
+
isFunction(value: any): boolean;
|
|
387
|
+
isAsyncFunction(value: any): boolean;
|
|
388
|
+
isObject(value: any): boolean;
|
|
389
|
+
isPlainObject(value: any): boolean;
|
|
390
|
+
isBoolean(value: any): boolean;
|
|
391
|
+
isString(value: any): boolean;
|
|
392
|
+
isSymbol(value: any): boolean;
|
|
393
|
+
isBigInt(value: any): boolean;
|
|
394
|
+
isUndefined(value: any): boolean;
|
|
395
|
+
isNull(value: any): boolean;
|
|
396
|
+
isNil(value: any): boolean;
|
|
397
|
+
isPrimitive(value: any): boolean;
|
|
398
|
+
isPromise(value: any): boolean;
|
|
399
|
+
isRegExp(value: any): boolean;
|
|
400
|
+
isDate(value: any): boolean;
|
|
401
|
+
isValidDate(value: any): boolean;
|
|
402
|
+
isMap(value: any): boolean;
|
|
403
|
+
isSet(value: any): boolean;
|
|
404
|
+
isWeakMap(value: any): boolean;
|
|
405
|
+
isWeakSet(value: any): boolean;
|
|
406
|
+
isIterable(value: any): boolean;
|
|
407
|
+
isBuffer(value: any): boolean;
|
|
408
|
+
isTypedArray(value: any): boolean;
|
|
409
|
+
isError(value: any): boolean;
|
|
410
|
+
isEmpty(value: any): boolean;
|
|
411
|
+
isEmail(value: any): boolean;
|
|
412
|
+
isURL(value: any, options?: {
|
|
413
|
+
protocols?: string[];
|
|
414
|
+
}): boolean;
|
|
415
|
+
isUUID(value: any): boolean;
|
|
416
|
+
isJSON(value: any): boolean;
|
|
417
|
+
isNumeric(value: any): boolean;
|
|
418
|
+
getEnv(value: string, envFilePath?: string): string | undefined;
|
|
419
|
+
createPath(path?: string): string;
|
|
420
|
+
getFoldersIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
421
|
+
getFolder(path?: string): string | undefined;
|
|
422
|
+
getFilesIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
423
|
+
getFile(path: string): string | undefined;
|
|
424
|
+
createFolder(path: string, force?: boolean): boolean | undefined;
|
|
425
|
+
createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean | undefined;
|
|
426
|
+
deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number | undefined;
|
|
427
|
+
deleteFolder(path: string): boolean | undefined;
|
|
428
|
+
deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number | undefined;
|
|
429
|
+
deleteFile(path: string): boolean | undefined;
|
|
430
|
+
copyFoldersIn(options: {
|
|
431
|
+
dest: string;
|
|
432
|
+
path?: string | undefined;
|
|
433
|
+
recursive?: boolean | undefined;
|
|
434
|
+
withFiles?: boolean | undefined;
|
|
435
|
+
force?: boolean | undefined;
|
|
436
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
437
|
+
}): number | undefined;
|
|
438
|
+
copyFolder(options: {
|
|
439
|
+
dest: string;
|
|
440
|
+
path?: string | undefined;
|
|
441
|
+
recursive?: boolean | undefined;
|
|
442
|
+
withFiles?: boolean | undefined;
|
|
443
|
+
force?: boolean | undefined;
|
|
444
|
+
}): boolean | undefined;
|
|
445
|
+
copyFilesIn(options: {
|
|
446
|
+
dest: string;
|
|
447
|
+
path?: string | undefined;
|
|
448
|
+
recursive?: boolean | undefined;
|
|
449
|
+
force?: boolean | undefined;
|
|
450
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
451
|
+
}): number | undefined;
|
|
452
|
+
copyFile(options: {
|
|
453
|
+
path: string;
|
|
454
|
+
dest: string;
|
|
455
|
+
force?: boolean | undefined;
|
|
456
|
+
}): boolean | undefined;
|
|
457
|
+
moveFoldersIn(options: {
|
|
458
|
+
dest: string;
|
|
459
|
+
path?: string | undefined;
|
|
460
|
+
recursive?: boolean | undefined;
|
|
461
|
+
withFiles?: boolean | undefined;
|
|
462
|
+
force?: boolean | undefined;
|
|
463
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
464
|
+
}): number | undefined;
|
|
465
|
+
moveFolder(options: {
|
|
466
|
+
path: string;
|
|
467
|
+
dest: string;
|
|
468
|
+
recursive?: boolean | undefined;
|
|
469
|
+
withFiles?: boolean | undefined;
|
|
470
|
+
force?: boolean | undefined;
|
|
471
|
+
}): boolean | undefined;
|
|
472
|
+
moveFilesIn(options: {
|
|
473
|
+
dest: string;
|
|
474
|
+
path?: string | undefined;
|
|
475
|
+
recursive?: boolean | undefined;
|
|
476
|
+
force?: boolean | undefined;
|
|
477
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
478
|
+
}): number | undefined;
|
|
479
|
+
moveFile(options: {
|
|
480
|
+
path: string;
|
|
481
|
+
dest: string;
|
|
482
|
+
force?: boolean | undefined;
|
|
483
|
+
}): boolean | undefined;
|
|
484
|
+
readFile(path: string): string | undefined;
|
|
485
|
+
readJSON<T>(path: string, fallback?: T): T | any | undefined;
|
|
486
|
+
writeJSON(path: string, data: any, options?: {
|
|
487
|
+
spaces?: number;
|
|
488
|
+
force?: boolean;
|
|
489
|
+
}): boolean;
|
|
490
|
+
appendFile(path: string, data: string): boolean;
|
|
491
|
+
exists(path: string): boolean;
|
|
492
|
+
stat(path: string): any | undefined;
|
|
493
|
+
fileSize(path: string): number | undefined;
|
|
494
|
+
hashFile(path: string, options?: {
|
|
495
|
+
algorithm?: string;
|
|
496
|
+
encoding?: "hex" | "base64" | "base64url";
|
|
497
|
+
}): string | undefined;
|
|
498
|
+
emptyFolder(path: string): boolean | undefined;
|
|
499
|
+
watch(options?: {
|
|
500
|
+
path?: string | undefined;
|
|
501
|
+
recursive?: boolean | undefined;
|
|
502
|
+
filter?: ((event: "rename" | "change", file: string) => boolean) | undefined;
|
|
503
|
+
}): {
|
|
504
|
+
on: <E extends "change" | "rename" | "all">(event: E, callback: E extends "all" ? (event: "change" | "rename", file: string) => void | Promise<void> : (file: string) => void | Promise<void>) => any;
|
|
505
|
+
stop: () => void;
|
|
506
|
+
pause: () => any;
|
|
507
|
+
resume: () => any;
|
|
508
|
+
} | undefined;
|
|
509
|
+
setTimestamp(value: boolean): Logger;
|
|
510
|
+
setDelimiter(options?: {
|
|
511
|
+
open?: string | undefined;
|
|
512
|
+
close?: string | undefined;
|
|
513
|
+
}): Logger;
|
|
514
|
+
log(content: any): Logger;
|
|
515
|
+
info(content: any): Logger;
|
|
516
|
+
success(content: any): Logger;
|
|
517
|
+
warn(content: any): Logger;
|
|
518
|
+
error(content: any): Logger;
|
|
519
|
+
debug(content: any): Logger;
|
|
520
|
+
group(label: string): Logger;
|
|
521
|
+
groupEnd(): Logger;
|
|
522
|
+
};
|
|
523
|
+
export = _exports;
|
|
524
|
+
import SQLite = require("./src/SQLite");
|
|
525
|
+
import time = require("./src/Time");
|
|
526
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";;;;;;;;;;;;;qBAuCuvF,CAAC;iBAAe,CAAC;;;oBAAy6B,CAAC;iBAAe,CAAC;;;;;;;;;;;;;;;;;gBAAk+M,CAAC;iBAAe,CAAC;oBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;oBAA9uJ,CAAC;kBAAgB,CAAC;eAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BALz/K,GAAA;mBAKwE,CAAC;;;;;4BAA+rC,GAAG;oBAAuJ,CAAC;;;;wBAAutC,GAAG;2BAA8oB,GAAG,wCAA+E,GAAG;;;;oBAA88B,CAAC;iBAAsB,CAAC;mBAAwB,CAAC;oBAAyB,CAAC;uBAA4B,CAAC;mBAA8D,CAAC;;;8CAA+rE,GAAG;iDAAgf,GAAG;mBAA0W,GAAG,uCAAuI,GAAG;2BAAkb,GAAG,2BAA0E,GAAG;yBAAoZ,GAAG;uBAAslB,GAAG,wBAAoE,GAAG;wBAA4jB,GAAG,kCAAqE,GAAG;;;;;;;;;;;gBAA5rI,CAAC;iBAAgB,CAAC;kBAAgB,CAAC;;;kBAAk9D,CAAC;mBAAiB,CAAC;;;kBAAuiE,CAAC;oBAAkB,CAAC;;;;;;oBAAo+H,CAAC;;;;;;yBAA8qD,CAAC;;;;;;;;;6BAAjsW,MAAM;qBAAgD,CAAC;oBAAkB,CAAC;;6BAAwe,MAAM,mBAA4C,MAAM;qBAA+C,CAAC;oBAAkB,CAAC;;8BAAwkB,MAAM,cAAuC,MAAM;;;;sCAA3B,MAAM;;;;YAAuZ,MAAM;2BAAiX,MAAM;4BAAo/B,MAAM;+BAA0R,MAAM;4BAAgT,MAAM;6BAAuW,MAAM;6BAAgb,MAAM;8BAA6Z,MAAM;oBAA0T,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA43Y,CAAC;iBAAe,CAAC;;;;;;;qBAA6wE,CAAC;oBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAxyX,CAAC;;;;;;;;;;;;;;;;;;qFAAp6L,CAAC;;;;;;;;;;;;;;;;iFAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAk6L,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAq/S,CAAC;aAAe,CAAC;;;;;;;iBAA6wE,CAAC;gBAAkB,CAAC;;;;;;;;;;;;;kCAA9hlB,MAAM;;;;QAAuZ,MAAM;uBAAiX,MAAM;wBAAo/B,MAAM;2BAA0R,MAAM;wBAAgT,MAAM;yBAAuW,MAAM;yBAAgb,MAAM;0BAA6Z,MAAM;gBAA0T,MAAM"}
|