@ix-xs/node-comfort 1.2.0 → 2.1.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +340 -0
  2. package/README.md +137 -548
  3. package/index.js +80 -35
  4. package/package.json +161 -33
  5. package/src/Arr.js +1050 -418
  6. package/src/Async.js +817 -0
  7. package/src/Cache.js +433 -0
  8. package/src/Checker.js +1202 -539
  9. package/src/Cli.js +1293 -0
  10. package/src/Color.js +556 -0
  11. package/src/Crypto.js +1082 -0
  12. package/src/Emitter.js +356 -0
  13. package/src/Env.js +689 -0
  14. package/src/FS.js +1626 -894
  15. package/src/Func.js +823 -356
  16. package/src/Http.js +700 -0
  17. package/src/Id.js +568 -200
  18. package/src/Logger.js +963 -378
  19. package/src/Num.js +965 -360
  20. package/src/Obj.js +1077 -379
  21. package/src/SQLite.js +1629 -1005
  22. package/src/Schema.js +2101 -0
  23. package/src/Str.js +1209 -432
  24. package/src/Sys.js +654 -0
  25. package/src/Time.js +1533 -440
  26. package/src/Utils.js +342 -325
  27. package/src/errors.js +335 -0
  28. package/src/internal/shared.js +415 -0
  29. package/types/index.d.ts +735 -526
  30. package/types/src/Arr.d.ts +533 -145
  31. package/types/src/Arr.d.ts.map +1 -1
  32. package/types/src/Async.d.ts +372 -0
  33. package/types/src/Async.d.ts.map +1 -0
  34. package/types/src/Cache.d.ts +221 -0
  35. package/types/src/Cache.d.ts.map +1 -0
  36. package/types/src/Checker.d.ts +651 -232
  37. package/types/src/Checker.d.ts.map +1 -1
  38. package/types/src/Cli.d.ts +664 -0
  39. package/types/src/Cli.d.ts.map +1 -0
  40. package/types/src/Color.d.ts +300 -0
  41. package/types/src/Color.d.ts.map +1 -0
  42. package/types/src/Crypto.d.ts +620 -0
  43. package/types/src/Crypto.d.ts.map +1 -0
  44. package/types/src/Emitter.d.ts +189 -0
  45. package/types/src/Emitter.d.ts.map +1 -0
  46. package/types/src/Env.d.ts +412 -0
  47. package/types/src/Env.d.ts.map +1 -0
  48. package/types/src/FS.d.ts +717 -238
  49. package/types/src/FS.d.ts.map +1 -1
  50. package/types/src/Func.d.ts +508 -135
  51. package/types/src/Func.d.ts.map +1 -1
  52. package/types/src/Http.d.ts +444 -0
  53. package/types/src/Http.d.ts.map +1 -0
  54. package/types/src/Id.d.ts +199 -66
  55. package/types/src/Id.d.ts.map +1 -1
  56. package/types/src/Logger.d.ts +414 -46
  57. package/types/src/Logger.d.ts.map +1 -1
  58. package/types/src/Num.d.ts +514 -137
  59. package/types/src/Num.d.ts.map +1 -1
  60. package/types/src/Obj.d.ts +453 -104
  61. package/types/src/Obj.d.ts.map +1 -1
  62. package/types/src/SQLite.d.ts +754 -308
  63. package/types/src/SQLite.d.ts.map +1 -1
  64. package/types/src/Schema.d.ts +1189 -0
  65. package/types/src/Schema.d.ts.map +1 -0
  66. package/types/src/Str.d.ts +617 -166
  67. package/types/src/Str.d.ts.map +1 -1
  68. package/types/src/Sys.d.ts +314 -0
  69. package/types/src/Sys.d.ts.map +1 -0
  70. package/types/src/Time.d.ts +759 -204
  71. package/types/src/Time.d.ts.map +1 -1
  72. package/types/src/Utils.d.ts +158 -102
  73. package/types/src/Utils.d.ts.map +1 -1
  74. package/types/src/errors.d.ts +316 -0
  75. package/types/src/errors.d.ts.map +1 -0
  76. package/types/src/internal/shared.d.ts +123 -0
  77. package/types/src/internal/shared.d.ts.map +1 -0
  78. package/types/index.d.ts.map +0 -1
package/types/index.d.ts CHANGED
@@ -1,526 +1,735 @@
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
1
+ // Generated by scripts/build-types.js. Do not edit by hand.
2
+ // @ix-xs/node-comfort v2.1.0
3
+
4
+ import _Arr = require("./src/Arr");
5
+ import _Async = require("./src/Async");
6
+ import _Cache = require("./src/Cache");
7
+ import _Checker = require("./src/Checker");
8
+ import _Cli = require("./src/Cli");
9
+ import _Color = require("./src/Color");
10
+ import _Crypto = require("./src/Crypto");
11
+ import _Emitter = require("./src/Emitter");
12
+ import _Env = require("./src/Env");
13
+ import _errors = require("./src/errors");
14
+ import _FS = require("./src/FS");
15
+ import _Func = require("./src/Func");
16
+ import _Http = require("./src/Http");
17
+ import _Id = require("./src/Id");
18
+ import _Logger = require("./src/Logger");
19
+ import _Num = require("./src/Num");
20
+ import _Obj = require("./src/Obj");
21
+ import _Schema = require("./src/Schema");
22
+ import _SQLite = require("./src/SQLite");
23
+ import _Str = require("./src/Str");
24
+ import _Sys = require("./src/Sys");
25
+ import _Time = require("./src/Time");
26
+ import _Utils = require("./src/Utils");
27
+
28
+ /**
29
+ * **@ix-xs/node-comfort**: The zero-dependency standard library for Node.js: logger, filesystem, SQLite, schema validation, HTTP client, CLI toolkit, cache, env, async pools, colors, events, i18n dates, ids, crypto and hundreds of fully typed helpers.
30
+ *
31
+ * @example
32
+ * const nc = require("@ix-xs/node-comfort");
33
+ * nc.info("Server ready");
34
+ * nc.str.slugify("Héllo World"); // "hello-world"
35
+ *
36
+ * @example
37
+ * import { nc, slugify, isEmail } from "@ix-xs/node-comfort";
38
+ */
39
+ declare namespace nodeComfort {
40
+
41
+ // Namespaces and classes
42
+ /**
43
+ * A console logger that works with zero setup: levels, colors, a small
44
+ * markup for styling, groups, timers and tables. In production, switch to
45
+ * one JSON object per line with `LOG_FORMAT=json`, and write to rotating
46
+ * files if you need to.
47
+ *
48
+ * Markup: `<% red bold Error:%> disk is full`. Any style name works, plus
49
+ * `#ff8800`, `bg#1e1e2e`, `rgb(255, 128, 0)` and `bgRgb(...)`.
50
+ *
51
+ * Levels, from chatty to severe: `trace`, `debug`, `info`, `warn`, `error`,
52
+ * `fatal`. The default is `info`; `LOG_LEVEL` changes it. `DEBUG=1` shows
53
+ * debug messages, and `DEBUG=db,http:*` only the debug and trace messages of
54
+ * the loggers with these scopes. Warnings and errors go to stderr.
55
+ *
56
+ * @example
57
+ * nc.info("Server listening on port 3000");
58
+ * nc.warn("Cache is almost full");
59
+ * nc.error(new Error("Payment failed", { cause: err }));
60
+ * nc.log("<% cyan bold Tip:%> press <% bgWhite black q %> to quit");
61
+ */
62
+ export import logger = _Logger;
63
+ /**
64
+ * Files and folders without try/catch: read and write text or JSON
65
+ * (atomically), copy, move, delete, list, glob, watch, hash.
66
+ *
67
+ * Paths: absolute paths are used as they are. Paths starting with `./` or
68
+ * `../` start from the file that calls the function, so a script works
69
+ * wherever it's run from. Other relative paths start from the working
70
+ * directory, like Node's `fs`.
71
+ *
72
+ * Everyday failures don't throw: you get `undefined` when something doesn't
73
+ * exist and `false` when an operation fails.
74
+ *
75
+ * @example
76
+ * nc.writeJSON("./data/settings.json", { theme: "dark" });
77
+ * const settings = nc.readJSON("./data/settings.json", {});
78
+ * const sources = nc.glob("src/**\/*.{js,ts}");
79
+ */
80
+ export import fs = _FS;
81
+ /**
82
+ * Type checks and validators. Every `isX` accepts anything and never throws,
83
+ * and most of them are type guards: inside `if (nc.isString(value))`, your
84
+ * editor knows `value` is a string, in JavaScript too.
85
+ *
86
+ * @example
87
+ * if (nc.isEmail(body.email) && nc.isPort(body.port)) connect(body);
88
+ * nc.assert(user, "User not found");
89
+ */
90
+ export import checker = _Checker;
91
+ /**
92
+ * Everyday helpers: `wait`, `when`, `dontCrash`, and JSON functions that
93
+ * don't throw. They are also available at the top level (`nc.wait()`).
94
+ *
95
+ * @example
96
+ * await nc.wait("1.5s");
97
+ * const settings = nc.JSONParse(text, {});
98
+ */
99
+ export import utils = _Utils;
100
+ /**
101
+ * String helpers: case conversion, slugs, truncation, templates, wrapping,
102
+ * fuzzy matching, plurals. Nothing is mutated, any value is accepted, and
103
+ * lengths are counted the way you see them, so 👨‍👩‍👧 is one character and
104
+ * is never cut in half.
105
+ *
106
+ * @example
107
+ * str.slugify("Héllo, Wörld!"); // "hello-world"
108
+ * str.camelCase("user_first-name"); // "userFirstName"
109
+ * str.plural(3, { one: "file", other: "files" }); // "3 files"
110
+ */
111
+ export import str = _Str;
112
+ /**
113
+ * Numbers: clamping, rounding that gets decimals right, statistics, and
114
+ * formatting for humans (sizes, money, ordinals, compact numbers) in any
115
+ * language. Formatting is English by default: change it with `setLocale()`
116
+ * or per call with `{ locale }`.
117
+ *
118
+ * @example
119
+ * num.round(1.005, 2); // 1.01
120
+ * num.formatBytes(1536); // "1.5 KB"
121
+ * num.currency(1234.5, "EUR", { locale: "fr" }); // "1 234,50 €"
122
+ * num.percentile(latencies, 95);
123
+ */
124
+ export import num = _Num;
125
+ /**
126
+ * Array helpers. None of them mutate what you pass in, and item types carry
127
+ * through (`chunk(numbers, 2)` is a `number[][]`). Many take an iteratee:
128
+ * a property name, which your editor completes, or a function.
129
+ *
130
+ * @example
131
+ * arr.chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
132
+ * arr.groupBy(users, "role"); // { admin: [...], user: [...] }
133
+ * arr.sortBy(users, ["lastName", "age"]);
134
+ */
135
+ export import arr = _Arr;
136
+ /**
137
+ * Object helpers: deep clone, merge, equality, diff, typed dot paths,
138
+ * pick and omit. Inputs are never mutated, and `__proto__`, `constructor`
139
+ * and `prototype` keys are always ignored, so user input can't pollute
140
+ * prototypes.
141
+ *
142
+ * @example
143
+ * obj.get(config, "db.pool.max", 10); // typed, paths autocompleted
144
+ * obj.set(state, "user.profile.name", "Ada"); // returns an updated copy
145
+ * obj.merge(defaults, userConfig);
146
+ */
147
+ export import obj = _Obj;
148
+ /**
149
+ * Function helpers: debounce, throttle, memoize, retry with backoff,
150
+ * timeouts, error handling without try/catch, and typed composition.
151
+ *
152
+ * @example
153
+ * const save = func.debounce(persist, 300);
154
+ * const data = await func.retry(() => fetchJSON(url), { attempts: 5, delay: 200, backoff: 2 });
155
+ * const [error, user] = await func.to(getUser(id));
156
+ */
157
+ export import func = _Func;
158
+ /**
159
+ * Dates and durations: formatting, relative time, calendar math, time zones
160
+ * and scheduling, in any language `Intl` knows. The default language is
161
+ * English so results are the same on every machine; change it with
162
+ * `setLocale()` or per call with `{ locale }`. Time zones work the same way
163
+ * with `setTimezone()` or `{ timeZone }`.
164
+ *
165
+ * @example
166
+ * time.setLocale("fr").setTimezone("Europe/Paris");
167
+ * time.relative(Date.now() - 3600e3); // "il y a 1 heure"
168
+ * time.format(new Date(), "dddd D MMMM YYYY"); // "lundi 15 janvier 2024"
169
+ * time.cron("0 9 * * 1-5", sendReport); // weekdays at 9:00
170
+ */
171
+ export import time = _Time;
172
+ /**
173
+ * Unique ids: UUID v4, v5 and v7, ULID, ObjectId, nanoid-style ids,
174
+ * Snowflakes, tokens and short codes. Random ones use the secure generator
175
+ * of `node:crypto`, with no bias.
176
+ *
177
+ * @example
178
+ * id.uuidv7(); // "0190a5c4-7c1e-7b2a-9f3e-1c2d3e4f5a6b", sorts by creation time
179
+ * id.nano(); // "V1StGXR8_Z5jdHi6B-myT"
180
+ * id.prefixed("user"); // "user_7Hq2mXc0LrT9aZ4bWk1PdE8s"
181
+ * id.code(); // "K7QF9X"
182
+ * id.token(32); // for API keys and reset links
183
+ */
184
+ export import id = _Id;
185
+ /**
186
+ * Crypto without the footguns, built on `node:crypto`: hashes, HMAC,
187
+ * password hashing (scrypt), encryption (AES-256-GCM), JWT, two-factor
188
+ * codes (TOTP) and secure random values.
189
+ *
190
+ * @example
191
+ * const stored = await crypto.hashPassword("hunter2");
192
+ * await crypto.verifyPassword("hunter2", stored); // true
193
+ *
194
+ * const token = crypto.signJWT({ sub: user.id }, SECRET, { expiresIn: "1h" });
195
+ * const claims = crypto.verifyJWT(token, SECRET);
196
+ */
197
+ export import crypto = _Crypto;
198
+ /**
199
+ * Terminal colors you can chain, like `chalk`. Truecolor is supported and
200
+ * downgraded on older terminals. Colors switch off by themselves when the
201
+ * output isn't a terminal or `NO_COLOR` is set; `FORCE_COLOR=1|2|3` turns
202
+ * them back on.
203
+ *
204
+ * @example
205
+ * console.log(color.green.bold("✔ Done"), color.gray("in 1.2s"));
206
+ * console.log(color.bgHex("#1e1e2e").hex("#cba6f7")(" nc "));
207
+ * console.log(color.gradient("node-comfort", ["#ff5f6d", "#ffc371"]));
208
+ */
209
+ export import color = _Color;
210
+ /**
211
+ * What you need for command-line tools: typed arguments with a generated
212
+ * `--help`, prompts, arrow-key menus, spinners, progress bars, tables and
213
+ * boxes. When nobody's at the keyboard (CI, pipes), prompts read plain lines
214
+ * and animations print only their final state.
215
+ *
216
+ * @example
217
+ * const { flags } = cli.args({
218
+ * port: { type: "number", short: "p", default: 3000, description: "Port to listen on" },
219
+ * });
220
+ * const name = await cli.prompt("Project name?", { default: "my-app" });
221
+ * const spin = cli.spinner("Installing").start();
222
+ * spin.succeed("Installed");
223
+ */
224
+ export import cli = _Cli;
225
+ /**
226
+ * Processes and the system: run commands and get their output, find
227
+ * executables, shut down cleanly, open URLs, and learn about the machine.
228
+ * Behaves the same on Windows, macOS and Linux; on Windows,
229
+ * `run("npm", [...])` finds `npm.cmd` and escapes arguments safely.
230
+ *
231
+ * @example
232
+ * const { stdout } = await sys.run("git", ["rev-parse", "HEAD"]);
233
+ * sys.onShutdown(async () => {
234
+ * await server.close();
235
+ * await db.close();
236
+ * });
237
+ */
238
+ export import sys = _Sys;
239
+ /**
240
+ * Promises and concurrency: map with a limit, queues with priorities,
241
+ * mutexes, polling, and friendlier `Promise.allSettled`.
242
+ *
243
+ * @example
244
+ * const pages = await async.map(urls, (url) => fetchPage(url), { concurrency: 5 });
245
+ *
246
+ * const limit = async.limit(2);
247
+ * await Promise.all(files.map((file) => limit(() => upload(file))));
248
+ *
249
+ * await async.poll(() => isServerReady(), { interval: 250, timeout: "10s" });
250
+ */
251
+ export import async = _Async;
252
+ /**
253
+ * Validate data with schemas, in the spirit of `zod`. Describe your data
254
+ * once and get both a runtime check with clear messages and the TypeScript
255
+ * type, `Infer<typeof schema>`. Schemas never change: `.min()` or
256
+ * `.optional()` return a new one.
257
+ *
258
+ * @example
259
+ * const User = s.object({
260
+ * name: s.string().trim().min(2),
261
+ * email: s.string().email().toLowerCase(),
262
+ * age: s.number().int().min(18).optional(),
263
+ * role: s.enum(["admin", "user"]).default("user"),
264
+ * });
265
+ *
266
+ * const user = User.parse(req.body); // typed, or a ValidationError listing every issue
267
+ * const result = User.safeParse(input); // { success, data } or { success, error, issues }
268
+ */
269
+ export import schema = _Schema;
270
+ /**
271
+ * An HTTP client on top of `fetch`: JSON by default, query objects, base
272
+ * URLs, timeouts, safe retries that respect `Retry-After`, typed errors,
273
+ * hooks, reusable clients and downloads with progress.
274
+ *
275
+ * @example
276
+ * const { data } = await http.get("https://api.github.com/repos/nodejs/node");
277
+ *
278
+ * const api = http.create({ baseURL: "https://api.example.com/v1/", auth: { bearer: process.env.TOKEN } });
279
+ * const { data: users } = await api.get("users", { query: { page: 2 } });
280
+ */
281
+ export import http = _Http;
282
+ /**
283
+ * Environment variables you can trust: `.env` loading, typed getters, and
284
+ * `validate()` to check your whole configuration at startup and report
285
+ * every problem at once.
286
+ *
287
+ * The `.env` file in the working directory is loaded when the package is
288
+ * required; variables that are already set are never overwritten. Set
289
+ * `NODE_COMFORT_DOTENV=false` to turn that off. What it loaded has the
290
+ * lowest priority: a file you load yourself afterwards wins over it.
291
+ *
292
+ * @example
293
+ * const config = env.validate({
294
+ * PORT: { type: "port", default: 3000 },
295
+ * DATABASE_URL: { type: "url" }, // required
296
+ * CACHE_TTL: { type: "duration", default: "5m" }, // in ms
297
+ * });
298
+ * config.PORT; // a number, typed in your editor
299
+ */
300
+ export import env = _Env;
301
+ /**
302
+ * The errors node-comfort throws when something goes wrong at run time: a
303
+ * request fails, data is invalid, a command exits badly. They all extend
304
+ * `NodeComfortError` (itself a regular `Error`) and carry a stable `code`,
305
+ * so you can branch on the kind of failure without parsing messages.
306
+ *
307
+ * A mistake in your own code, like a wrong argument, still throws a plain
308
+ * `TypeError` or `RangeError`, as it does everywhere in JavaScript.
309
+ *
310
+ * @example
311
+ * try {
312
+ * await nc.http.get("https://api.example.com/users/42");
313
+ * } catch (error) {
314
+ * if (error instanceof nc.errors.HttpError && error.status === 404) return null;
315
+ * throw error;
316
+ * }
317
+ */
318
+ export import errors = _errors;
319
+ /**
320
+ * SQLite made pleasant, on the engine built into Node.js (22.13+): CRUD with
321
+ * rich filters, JSON and boolean columns, transactions, migrations and
322
+ * backups. Methods are synchronous, like the engine, but `await` still
323
+ * works. Errors are `SQLiteError`s. Values are always bound as parameters
324
+ * and names are checked, so there's no SQL injection through them.
325
+ *
326
+ * @example
327
+ * const db = new nc.SQLite("data/app.sqlite");
328
+ * db.createTable({
329
+ * name: "users",
330
+ * columns: {
331
+ * id: { type: "INTEGER", primaryKey: true, autoincrement: true },
332
+ * email: { type: "TEXT", notNull: true, unique: true },
333
+ * settings: { type: "JSON", defaultValue: {} },
334
+ * },
335
+ * });
336
+ * db.insert("users", { email: "ada@example.com", settings: { theme: "dark" } });
337
+ * db.getAll("users", { email: { like: "%@example.com" } }, { orderBy: "email", limit: 20 });
338
+ */
339
+ export import SQLite = _SQLite;
340
+ /**
341
+ * An in-memory cache with a size limit (the least recently used entries go
342
+ * first), expiry per entry, and stats. `getOrSet()` loads a missing value
343
+ * only once, even when many callers ask for it at the same moment.
344
+ *
345
+ * @example
346
+ * const users = new nc.Cache({ max: 1000, ttl: "5m" });
347
+ * const user = await users.getOrSet(id, () => db.users.find(id));
348
+ * users.stats; // { hits: 12, misses: 3, hitRate: 0.8, ... }
349
+ */
350
+ export import Cache = _Cache;
351
+ /**
352
+ * A small typed event emitter. Declare your events once, and your editor
353
+ * checks every event name and listener argument. `on()` returns a function
354
+ * that removes the listener, and you can `await` an event or loop over
355
+ * events with `for await`.
356
+ *
357
+ * @example
358
+ * const chat = new nc.Emitter<{ message: [text: string, from: string]; close: [] }>();
359
+ * const off = chat.on("message", (text, from) => console.log(`${from}: ${text}`));
360
+ * chat.emit("message", "hello", "ada");
361
+ * off();
362
+ * const [text] = await chat.waitFor("message", { timeout: "5s" });
363
+ */
364
+ export import Emitter = _Emitter;
365
+
366
+ // Flat helpers (logger, fs, checker, utils)
367
+ export import log = _Logger.log;
368
+ export import trace = _Logger.trace;
369
+ export import debug = _Logger.debug;
370
+ export import info = _Logger.info;
371
+ export import success = _Logger.success;
372
+ export import warn = _Logger.warn;
373
+ export import error = _Logger.error;
374
+ export import fatal = _Logger.fatal;
375
+ export import group = _Logger.group;
376
+ export import groupEnd = _Logger.groupEnd;
377
+ export import timeStart = _Logger.timeStart;
378
+ export import timeEnd = _Logger.timeEnd;
379
+ export import table = _Logger.table;
380
+ export import box = _Logger.box;
381
+ export import divider = _Logger.divider;
382
+ export import setLevel = _Logger.setLevel;
383
+ export import getLevel = _Logger.getLevel;
384
+ export import isLevelEnabled = _Logger.isLevelEnabled;
385
+ export import configure = _Logger.configure;
386
+ export import setTimestamp = _Logger.setTimestamp;
387
+ export import setDelimiter = _Logger.setDelimiter;
388
+ export import createLogger = _Logger.createLogger;
389
+ export import getEnv = _FS.getEnv;
390
+ export import createPath = _FS.createPath;
391
+ export import getFolder = _FS.getFolder;
392
+ export import getFile = _FS.getFile;
393
+ export import getFoldersIn = _FS.getFoldersIn;
394
+ export import getFilesIn = _FS.getFilesIn;
395
+ export import glob = _FS.glob;
396
+ export import find = _FS.find;
397
+ export import findUp = _FS.findUp;
398
+ export import readFile = _FS.readFile;
399
+ export import readLines = _FS.readLines;
400
+ export import readJSON = _FS.readJSON;
401
+ export import writeFile = _FS.writeFile;
402
+ export import writeJSON = _FS.writeJSON;
403
+ export import appendFile = _FS.appendFile;
404
+ export import createFile = _FS.createFile;
405
+ export import createFolder = _FS.createFolder;
406
+ export import ensureFolder = _FS.ensureFolder;
407
+ export import ensureFile = _FS.ensureFile;
408
+ export import touch = _FS.touch;
409
+ export import deleteFolder = _FS.deleteFolder;
410
+ export import deleteFile = _FS.deleteFile;
411
+ export import remove = _FS.remove;
412
+ export import deleteFoldersIn = _FS.deleteFoldersIn;
413
+ export import deleteFilesIn = _FS.deleteFilesIn;
414
+ export import emptyFolder = _FS.emptyFolder;
415
+ export import copy = _FS.copy;
416
+ export import move = _FS.move;
417
+ export import copyFoldersIn = _FS.copyFoldersIn;
418
+ export import copyFolder = _FS.copyFolder;
419
+ export import copyFilesIn = _FS.copyFilesIn;
420
+ export import copyFile = _FS.copyFile;
421
+ export import moveFoldersIn = _FS.moveFoldersIn;
422
+ export import moveFolder = _FS.moveFolder;
423
+ export import moveFilesIn = _FS.moveFilesIn;
424
+ export import moveFile = _FS.moveFile;
425
+ export import exists = _FS.exists;
426
+ export import isFile = _FS.isFile;
427
+ export import isFolder = _FS.isFolder;
428
+ export import stat = _FS.stat;
429
+ export import fileSize = _FS.fileSize;
430
+ export import folderSize = _FS.folderSize;
431
+ export import hashFile = _FS.hashFile;
432
+ export import tempFolder = _FS.tempFolder;
433
+ export import sanitizeFilename = _FS.sanitizeFilename;
434
+ export import watch = _FS.watch;
435
+ export import isArray = _Checker.isArray;
436
+ export import isNumber = _Checker.isNumber;
437
+ export import isFinite = _Checker.isFinite;
438
+ export import isInteger = _Checker.isInteger;
439
+ export import isSafeInteger = _Checker.isSafeInteger;
440
+ export import isFloat = _Checker.isFloat;
441
+ export import isPositive = _Checker.isPositive;
442
+ export import isNegative = _Checker.isNegative;
443
+ export import isBoolean = _Checker.isBoolean;
444
+ export import isString = _Checker.isString;
445
+ export import isSymbol = _Checker.isSymbol;
446
+ export import isBigInt = _Checker.isBigInt;
447
+ export import isUndefined = _Checker.isUndefined;
448
+ export import isNull = _Checker.isNull;
449
+ export import isNil = _Checker.isNil;
450
+ export import isDefined = _Checker.isDefined;
451
+ export import isPrimitive = _Checker.isPrimitive;
452
+ export import isFunction = _Checker.isFunction;
453
+ export import isAsyncFunction = _Checker.isAsyncFunction;
454
+ export import isGeneratorFunction = _Checker.isGeneratorFunction;
455
+ export import isGenerator = _Checker.isGenerator;
456
+ export import isClass = _Checker.isClass;
457
+ export import isObject = _Checker.isObject;
458
+ export import isPlainObject = _Checker.isPlainObject;
459
+ export import isPromise = _Checker.isPromise;
460
+ export import isRegExp = _Checker.isRegExp;
461
+ export import isDate = _Checker.isDate;
462
+ export import isValidDate = _Checker.isValidDate;
463
+ export import isMap = _Checker.isMap;
464
+ export import isSet = _Checker.isSet;
465
+ export import isWeakMap = _Checker.isWeakMap;
466
+ export import isWeakSet = _Checker.isWeakSet;
467
+ export import isIterable = _Checker.isIterable;
468
+ export import isAsyncIterable = _Checker.isAsyncIterable;
469
+ export import isBuffer = _Checker.isBuffer;
470
+ export import isTypedArray = _Checker.isTypedArray;
471
+ export import isError = _Checker.isError;
472
+ export import isEmpty = _Checker.isEmpty;
473
+ export import isBlank = _Checker.isBlank;
474
+ export import isArrayOf = _Checker.isArrayOf;
475
+ export import isOneOf = _Checker.isOneOf;
476
+ export import isEmail = _Checker.isEmail;
477
+ export import isURL = _Checker.isURL;
478
+ export import isUUID = _Checker.isUUID;
479
+ export import isJSON = _Checker.isJSON;
480
+ export import isNumeric = _Checker.isNumeric;
481
+ export import isIP = _Checker.isIP;
482
+ export import isIPv4 = _Checker.isIPv4;
483
+ export import isIPv6 = _Checker.isIPv6;
484
+ export import isPort = _Checker.isPort;
485
+ export import isHex = _Checker.isHex;
486
+ export import isHexColor = _Checker.isHexColor;
487
+ export import isBase64 = _Checker.isBase64;
488
+ export import isSemver = _Checker.isSemver;
489
+ export import isISODate = _Checker.isISODate;
490
+ export import isSlug = _Checker.isSlug;
491
+ export import isAlpha = _Checker.isAlpha;
492
+ export import isAlphanumeric = _Checker.isAlphanumeric;
493
+ export import isCreditCard = _Checker.isCreditCard;
494
+ export import isJWT = _Checker.isJWT;
495
+ export import isHostname = _Checker.isHostname;
496
+ export import isMACAddress = _Checker.isMACAddress;
497
+ export import isIBAN = _Checker.isIBAN;
498
+ export import isE164 = _Checker.isE164;
499
+ export import isObjectId = _Checker.isObjectId;
500
+ export import isULID = _Checker.isULID;
501
+ export import isDataURL = _Checker.isDataURL;
502
+ export import isMimeType = _Checker.isMimeType;
503
+ export import isTimeZone = _Checker.isTimeZone;
504
+ export import isLocale = _Checker.isLocale;
505
+ export import isCron = _Checker.isCron;
506
+ export import isASCII = _Checker.isASCII;
507
+ export import assert = _Checker.assert;
508
+ export import assertType = _Checker.assertType;
509
+ export import wait = _Utils.wait;
510
+ export import when = _Utils.when;
511
+ export import dontCrash = _Utils.dontCrash;
512
+ export import JSONString = _Utils.JSONString;
513
+ export import JSONParse = _Utils.JSONParse;
514
+
515
+ // Types
516
+ export import AnyTypedArray = _Checker.AnyTypedArray;
517
+ export import ArgsOptions = _Cli.ArgsOptions;
518
+ export import BatchedFunction = _Func.BatchedFunction;
519
+ export import BatchOptions = _Func.BatchOptions;
520
+ export import BorderStyle = _Cli.BorderStyle;
521
+ export import BoxOptions = _Cli.BoxOptions;
522
+ export import CacheEntry = _Cache.CacheEntry;
523
+ export import CacheOptions = _Cache.CacheOptions;
524
+ export import CacheRemovalReason = _Cache.CacheRemovalReason;
525
+ export import CacheSetOptions = _Cache.CacheSetOptions;
526
+ export import CacheStats = _Cache.CacheStats;
527
+ export import CalendarOptions = _Time.CalendarOptions;
528
+ export import CalendarUnit = _Time.CalendarUnit;
529
+ export import Change = _Obj.Change;
530
+ export import ChangeResult = _SQLite.ChangeResult;
531
+ export import Choice = _Cli.Choice;
532
+ export import ClosestOptions = _Str.ClosestOptions;
533
+ export import CoerceBuilders = _Schema.CoerceBuilders;
534
+ export import ColorChain = _Color.ColorChain;
535
+ export import ColorHelpers = _Color.ColorHelpers;
536
+ export import ColorLevel = _Color.ColorLevel;
537
+ export import ColorMethods = _Color.ColorMethods;
538
+ export import ColorModule = _Color.ColorModule;
539
+ export import ColorStyleProps = _Color.ColorStyleProps;
540
+ export import ColorStyles = _Color.ColorStyles;
541
+ export import ColumnDefinition = _SQLite.ColumnDefinition;
542
+ export import ColumnInfo = _SQLite.ColumnInfo;
543
+ export import ColumnType = _SQLite.ColumnType;
544
+ export import CompactOptions = _Obj.CompactOptions;
545
+ export import CompareOptions = _Str.CompareOptions;
546
+ export import ConfirmOptions = _Cli.ConfirmOptions;
547
+ export import CopyFileOptions = _FS.CopyFileOptions;
548
+ export import CopyFilesOptions = _FS.CopyFilesOptions;
549
+ export import CopyFolderOptions = _FS.CopyFolderOptions;
550
+ export import CopyFoldersOptions = _FS.CopyFoldersOptions;
551
+ export import CopyOptions = _FS.CopyOptions;
552
+ export import CronOptions = _Time.CronOptions;
553
+ export import CurrencyOptions = _Num.CurrencyOptions;
554
+ export import DateInput = _Time.DateInput;
555
+ export import DateRangeOptions = _Time.DateRangeOptions;
556
+ export import DebouncedFunction = _Func.DebouncedFunction;
557
+ export import DebounceOptions = _Func.DebounceOptions;
558
+ export import DecodedJWT = _Crypto.DecodedJWT;
559
+ export import DecryptOptions = _Crypto.DecryptOptions;
560
+ export import DeepReadonly = _Obj.DeepReadonly;
561
+ export import Deferred = _Async.Deferred;
562
+ export import DigestEncoding = _Crypto.DigestEncoding;
563
+ export import DontCrashController = _Utils.DontCrashController;
564
+ export import DontCrashEvent = _Utils.DontCrashEvent;
565
+ export import DurationUnit = _Time.DurationUnit;
566
+ export import EncryptOptions = _Crypto.EncryptOptions;
567
+ export import EnvConfig = _Env.EnvConfig;
568
+ export import EnvGetterOptions = _Env.EnvGetterOptions;
569
+ export import EnvLoadOptions = _Env.EnvLoadOptions;
570
+ export import EnvParseOptions = _Env.EnvParseOptions;
571
+ export import EnvVarSpec = _Env.EnvVarSpec;
572
+ export import EnvVarValue = _Env.EnvVarValue;
573
+ export import EventMap = _Emitter.EventMap;
574
+ export import EveryOptions = _Time.EveryOptions;
575
+ export import FindOptions = _FS.FindOptions;
576
+ export import FlagSpec = _Cli.FlagSpec;
577
+ export import FlagValue = _Cli.FlagValue;
578
+ export import ForeignKeyAction = _SQLite.ForeignKeyAction;
579
+ export import FormatBytesOptions = _Num.FormatBytesOptions;
580
+ export import FormatDateOptions = _Time.FormatDateOptions;
581
+ export import FormatDurationOptions = _Time.FormatDurationOptions;
582
+ export import FormatNumberOptions = _Num.FormatNumberOptions;
583
+ export import GlobOptions = _FS.GlobOptions;
584
+ export import HashOptions = _Crypto.HashOptions;
585
+ export import HashPasswordOptions = _Crypto.HashPasswordOptions;
586
+ export import HttpBody = _Http.HttpBody;
587
+ export import HttpClient = _Http.HttpClient;
588
+ export import HttpHeaders = _Http.HttpHeaders;
589
+ export import HttpHooks = _Http.HttpHooks;
590
+ export import HttpMethod = _Http.HttpMethod;
591
+ export import HttpOptions = _Http.HttpOptions;
592
+ export import HttpOptionsOf = _Http.HttpOptionsOf;
593
+ export import HttpRequestConfig = _Http.HttpRequestConfig;
594
+ export import HttpResponse = _Http.HttpResponse;
595
+ export import HttpRetryOptions = _Http.HttpRetryOptions;
596
+ export import IndexDefinition = _SQLite.IndexDefinition;
597
+ export import Infer = _Schema.Infer;
598
+ export import InsertOptions = _SQLite.InsertOptions;
599
+ export import InsertResult = _SQLite.InsertResult;
600
+ export import IsBase64Options = _Checker.IsBase64Options;
601
+ export import IsHostnameOptions = _Checker.IsHostnameOptions;
602
+ export import IsURLOptions = _Checker.IsURLOptions;
603
+ export import IsUUIDOptions = _Checker.IsUUIDOptions;
604
+ export import Iteratee = _Arr.Iteratee;
605
+ export import JSONSchema = _Schema.JSONSchema;
606
+ export import JWTAlgorithm = _Crypto.JWTAlgorithm;
607
+ export import JWTClaims = _Crypto.JWTClaims;
608
+ export import JWTKey = _Crypto.JWTKey;
609
+ export import KeyPair = _Crypto.KeyPair;
610
+ export import Limiter = _Async.Limiter;
611
+ export import ListenOptions = _Emitter.ListenOptions;
612
+ export import ListOptions = _FS.ListOptions;
613
+ export import LogEntry = _Logger.LogEntry;
614
+ export import LogFileOptions = _Logger.LogFileOptions;
615
+ export import Logger = _Logger.Logger;
616
+ export import LoggerOptions = _Logger.LoggerOptions;
617
+ export import LogLevel = _Logger.LogLevel;
618
+ export import LogStream = _Logger.LogStream;
619
+ export import MapOptions = _Async.MapOptions;
620
+ export import MaskOptions = _Str.MaskOptions;
621
+ export import MemoizedFunction = _Func.MemoizedFunction;
622
+ export import MemoizeOptions = _Func.MemoizeOptions;
623
+ export import MergeOptions = _Obj.MergeOptions;
624
+ export import Message = _Schema.Message;
625
+ export import Migration = _SQLite.Migration;
626
+ export import Mutex = _Async.Mutex;
627
+ export import NodeComfortErrorOptions = _errors.NodeComfortErrorOptions;
628
+ export import NullishToUndefined = _Obj.NullishToUndefined;
629
+ export import ObjectOutput = _Schema.ObjectOutput;
630
+ export import OrdinalOptions = _Num.OrdinalOptions;
631
+ export import Page = _Arr.Page;
632
+ export import PaginateOptions = _SQLite.PaginateOptions;
633
+ export import ParseBytesOptions = _Num.ParseBytesOptions;
634
+ export import ParseContext = _Schema.ParseContext;
635
+ export import ParsedArgs = _Cli.ParsedArgs;
636
+ export import ParseDateOptions = _Time.ParseDateOptions;
637
+ export import ParsedFlags = _Cli.ParsedFlags;
638
+ export import ParsedSnowflake = _Id.ParsedSnowflake;
639
+ export import PathInput = _Obj.PathInput;
640
+ export import PathLeaf = _Obj.PathLeaf;
641
+ export import Paths = _Obj.Paths;
642
+ export import PathStep = _Obj.PathStep;
643
+ export import PathValue = _Obj.PathValue;
644
+ export import PluralForms = _Str.PluralForms;
645
+ export import PluralOptions = _Str.PluralOptions;
646
+ export import PollOptions = _Async.PollOptions;
647
+ export import Primitive = _Checker.Primitive;
648
+ export import ProgressBar = _Cli.ProgressBar;
649
+ export import ProgressOptions = _Cli.ProgressOptions;
650
+ export import PromptOptions = _Cli.PromptOptions;
651
+ export import QueryOptions = _SQLite.QueryOptions;
652
+ export import QueryParams = _Http.QueryParams;
653
+ export import Queue = _Async.Queue;
654
+ export import QueueAddOptions = _Async.QueueAddOptions;
655
+ export import QueueOptions = _Async.QueueOptions;
656
+ export import RandomStringOptions = _Str.RandomStringOptions;
657
+ export import RateLimiter = _Async.RateLimiter;
658
+ export import ReadJSONOptions = _FS.ReadJSONOptions;
659
+ export import RefineOptions = _Schema.RefineOptions;
660
+ export import RelativeOptions = _Time.RelativeOptions;
661
+ export import ResponseSchema = _Http.ResponseSchema;
662
+ export import RetryOptions = _Func.RetryOptions;
663
+ export import RunOptions = _Sys.RunOptions;
664
+ export import RunResult = _Sys.RunResult;
665
+ export import SafeParseResult = _Schema.SafeParseResult;
666
+ export import ScheduledTask = _Time.ScheduledTask;
667
+ export import SelectOptions = _Cli.SelectOptions;
668
+ export import Settled = _Async.Settled;
669
+ export import Shape = _Schema.Shape;
670
+ export import ShutdownOptions = _Sys.ShutdownOptions;
671
+ export import ShutdownReason = _Sys.ShutdownReason;
672
+ export import SignJWTOptions = _Crypto.SignJWTOptions;
673
+ export import Simplify = _Schema.Simplify;
674
+ export import SlugifyOptions = _Str.SlugifyOptions;
675
+ export import SnowflakeOptions = _Id.SnowflakeOptions;
676
+ export import SortByOptions = _Arr.SortByOptions;
677
+ export import SortDirection = _SQLite.SortDirection;
678
+ export import SortKey = _Arr.SortKey;
679
+ export import SortKeysOptions = _Obj.SortKeysOptions;
680
+ export import Spinner = _Cli.Spinner;
681
+ export import SpinnerOptions = _Cli.SpinnerOptions;
682
+ export import SpinOptions = _Cli.SpinOptions;
683
+ export import SQLiteOptions = _SQLite.SQLiteOptions;
684
+ export import StartOfUnit = _Time.StartOfUnit;
685
+ export import Step = _Schema.Step;
686
+ export import Stopwatch = _Time.Stopwatch;
687
+ export import StyleEntry = _Color.StyleEntry;
688
+ export import StyleName = _Color.StyleName;
689
+ export import SystemInfo = _Sys.SystemInfo;
690
+ export import TableColumn = _Cli.TableColumn;
691
+ export import TableConstraint = _SQLite.TableConstraint;
692
+ export import TableDefinition = _SQLite.TableDefinition;
693
+ export import TableHandle = _SQLite.TableHandle;
694
+ export import TableOptions = _Cli.TableOptions;
695
+ export import TemplateOptions = _Str.TemplateOptions;
696
+ export import ThrottledFunction = _Func.ThrottledFunction;
697
+ export import ThrottleOptions = _Func.ThrottleOptions;
698
+ export import TimeZoneOptions = _Time.TimeZoneOptions;
699
+ export import TokenEncoding = _Id.TokenEncoding;
700
+ export import ToSentenceOptions = _Arr.ToSentenceOptions;
701
+ export import TOTPOptions = _Crypto.TOTPOptions;
702
+ export import TOTPURIOptions = _Crypto.TOTPURIOptions;
703
+ export import TransactionOptions = _SQLite.TransactionOptions;
704
+ export import TreeOptions = _Cli.TreeOptions;
705
+ export import TruncateOptions = _Str.TruncateOptions;
706
+ export import UUIDNamespace = _Id.UUIDNamespace;
707
+ export import ValidationIssue = _errors.ValidationIssue;
708
+ export import VarianceOptions = _Num.VarianceOptions;
709
+ export import VerifyJWTOptions = _Crypto.VerifyJWTOptions;
710
+ export import VerifyTOTPOptions = _Crypto.VerifyTOTPOptions;
711
+ export import WaitForOptions = _Emitter.WaitForOptions;
712
+ export import WaitOptions = _Utils.WaitOptions;
713
+ export import Watcher = _FS.Watcher;
714
+ export import WatchOptions = _FS.WatchOptions;
715
+ export import WeekOptions = _Time.WeekOptions;
716
+ export import WhenOptions = _Utils.WhenOptions;
717
+ export import WhenTask = _Utils.WhenTask;
718
+ export import Where = _SQLite.Where;
719
+ export import WhereOperators = _SQLite.WhereOperators;
720
+ export import WhereValue = _SQLite.WhereValue;
721
+ export import WrapOptions = _Str.WrapOptions;
722
+ export import WriteFileOptions = _FS.WriteFileOptions;
723
+ export import WriteJSONOptions = _FS.WriteJSONOptions;
724
+
725
+ // Self references
726
+ /**
727
+ * The whole toolkit. Lets you write `const { nc } = require("@ix-xs/node-comfort")`
728
+ * or `import { nc } from "@ix-xs/node-comfort"`.
729
+ */
730
+ export const nc: typeof import("./index.js");
731
+ /** The whole toolkit (same object as `nc`). */
732
+ export const nodeComfort: typeof import("./index.js");
733
+ }
734
+
735
+ export = nodeComfort;