qznt 1.0.36 → 2.0.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/README.md +29 -58
- package/dist/index.cjs +493 -646
- package/dist/index.d.cts +670 -0
- package/dist/index.d.ts +368 -530
- package/dist/index.js +449 -607
- package/package.json +6 -8
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -832
- package/dist/index.js.map +0 -1
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
package/dist/index.d.mts
DELETED
|
@@ -1,832 +0,0 @@
|
|
|
1
|
-
type SequentialMapContext<T, U> = {
|
|
2
|
-
index: number;
|
|
3
|
-
lastElement: U | undefined;
|
|
4
|
-
newArray: ReadonlyArray<U>;
|
|
5
|
-
originalArray: ReadonlyArray<T>;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Splits an array into sub-arrays (chunks) of a maximum size.
|
|
9
|
-
* @param array Array to process.
|
|
10
|
-
* @param size The maximum size of each chunk.
|
|
11
|
-
*/
|
|
12
|
-
declare function chunk<T>(array: ReadonlyArray<T>, size: number): T[][];
|
|
13
|
-
/**
|
|
14
|
-
* Groups adjacent elements of an array together based on a predicate.
|
|
15
|
-
* @param array Array to process.
|
|
16
|
-
* @param predicate A function that returns true if two adjacent elements belong in the same chunk.
|
|
17
|
-
* @example
|
|
18
|
-
* // Group consecutive identical numbers
|
|
19
|
-
* chunkBy([1, 1, 2, 3, 3, 3], (a, b) => a === b);
|
|
20
|
-
* // [[1, 1], [2], [3, 3, 3]]
|
|
21
|
-
*/
|
|
22
|
-
declare function chunkAdj<T>(array: ReadonlyArray<T>, predicate: (prev: T, curr: T) => boolean): T[][];
|
|
23
|
-
/**
|
|
24
|
-
* Groups elements by a key.
|
|
25
|
-
* @param array Array to process.
|
|
26
|
-
* @param iteratee Function to determine the key to group by.
|
|
27
|
-
* @param maxChunkSize Optionally chunk groups and flatten them (useful for pagination).
|
|
28
|
-
*/
|
|
29
|
-
declare function cluster<T>(array: ReadonlyArray<T>, iteratee: (item: T) => string | number, maxChunkSize?: number): T[][];
|
|
30
|
-
/**
|
|
31
|
-
* Removes unwanted values from an array.
|
|
32
|
-
* @param array Array to process.
|
|
33
|
-
* @param mode 'nullable' (default) removes null/undefined. 'falsy' removes null, undefined, 0, "", false, and NaN.
|
|
34
|
-
*/
|
|
35
|
-
declare function compact<T>(array: ReadonlyArray<T>, mode?: "nullable"): NonNullable<T>[];
|
|
36
|
-
declare function compact<T>(array: ReadonlyArray<T>, mode: "falsy"): Exclude<T, null | undefined | false | 0 | "">[];
|
|
37
|
-
/**
|
|
38
|
-
* Forces a given item to be an array.
|
|
39
|
-
* @param item The item to force into an array.
|
|
40
|
-
*/
|
|
41
|
-
declare function forceArray<T>(item: T): T[];
|
|
42
|
-
/**
|
|
43
|
-
* Searches a sorted array for a value using the binary search method.
|
|
44
|
-
* Returns the index if found, or the bitwise complement (~index) of the
|
|
45
|
-
* position where the value should be inserted to keep it sorted.
|
|
46
|
-
* @param array The array to process.
|
|
47
|
-
* @param target The value to search for.
|
|
48
|
-
* @param comparator Optional comparator function.
|
|
49
|
-
*/
|
|
50
|
-
declare function search<T>(array: T[], target: T, comparator?: (a: T, b: T) => number): number;
|
|
51
|
-
/**
|
|
52
|
-
* Maps over an array with access to the previously mapped elements.
|
|
53
|
-
* @param array Array to process.
|
|
54
|
-
* @param callback Function to map over the array.
|
|
55
|
-
*/
|
|
56
|
-
declare function seqMap<T, U>(array: ReadonlyArray<T>, callback: (item: T, context: SequentialMapContext<T, U>) => U): U[];
|
|
57
|
-
/**
|
|
58
|
-
* Shuffles an array using the Fisher-Yates algorithm.
|
|
59
|
-
* @param array The array to shuffle.
|
|
60
|
-
* @param seed Optional seed for RNG.
|
|
61
|
-
*/
|
|
62
|
-
declare function shuffle<T>(array: ReadonlyArray<T>, seed?: number): T[];
|
|
63
|
-
/**
|
|
64
|
-
* Sorts an array by a single property in order.
|
|
65
|
-
* @param order 'asc' for ascending (default) or 'desc' for descending.
|
|
66
|
-
* @param array Array to process.
|
|
67
|
-
* @param selector Function to determine the key to sort by.
|
|
68
|
-
*/
|
|
69
|
-
declare function sortBy<T>(array: ReadonlyArray<T>, selector: (item: T) => any, order?: "asc" | "desc"): T[];
|
|
70
|
-
/**
|
|
71
|
-
* Sorts an array by one or more properties in order.
|
|
72
|
-
* @param order 'asc' for ascending (default) or 'desc' for descending.
|
|
73
|
-
* @param array Array to process.
|
|
74
|
-
* @param selectors Functions to determine the keys to sort by.
|
|
75
|
-
*/
|
|
76
|
-
declare function sortBy<T>(array: ReadonlyArray<T>, selectors: (item: T) => any[], order?: "asc" | "desc"): T[];
|
|
77
|
-
/**
|
|
78
|
-
* Returns an array of unique elements from the given array.
|
|
79
|
-
* Uniqueness is determined by the given key function.
|
|
80
|
-
* @param array Array to process.
|
|
81
|
-
* @param key Function to determine the keys to filter by
|
|
82
|
-
*/
|
|
83
|
-
declare function unique<T>(array: T[], key: (item: T) => any): T[];
|
|
84
|
-
|
|
85
|
-
type arr_SequentialMapContext<T, U> = SequentialMapContext<T, U>;
|
|
86
|
-
declare const arr_chunk: typeof chunk;
|
|
87
|
-
declare const arr_chunkAdj: typeof chunkAdj;
|
|
88
|
-
declare const arr_cluster: typeof cluster;
|
|
89
|
-
declare const arr_compact: typeof compact;
|
|
90
|
-
declare const arr_forceArray: typeof forceArray;
|
|
91
|
-
declare const arr_search: typeof search;
|
|
92
|
-
declare const arr_seqMap: typeof seqMap;
|
|
93
|
-
declare const arr_shuffle: typeof shuffle;
|
|
94
|
-
declare const arr_sortBy: typeof sortBy;
|
|
95
|
-
declare const arr_unique: typeof unique;
|
|
96
|
-
declare namespace arr {
|
|
97
|
-
export { type arr_SequentialMapContext as SequentialMapContext, arr_chunk as chunk, arr_chunkAdj as chunkAdj, arr_cluster as cluster, arr_compact as compact, arr_forceArray as forceArray, arr_search as search, arr_seqMap as seqMap, arr_shuffle as shuffle, arr_sortBy as sortBy, arr_unique as unique };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
interface RetryOptions {
|
|
101
|
-
/** Maximum number of retry attempts. @defaultValue 3 */
|
|
102
|
-
retries?: number;
|
|
103
|
-
/** Initial delay in milliseconds. @defaultValue 500 */
|
|
104
|
-
delay?: number;
|
|
105
|
-
/** Timeout in milliseconds for each attempt. */
|
|
106
|
-
timeout?: number;
|
|
107
|
-
/** An AbortSignal to cancel the entire operation. */
|
|
108
|
-
signal?: AbortSignal;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Retries an async function until the maximum number of attempts is reached.
|
|
112
|
-
*
|
|
113
|
-
* Implements exponential backoff with random jitter.
|
|
114
|
-
* @param fn The asynchronous function to attempt.
|
|
115
|
-
* @param options Options for the retry function.
|
|
116
|
-
*/
|
|
117
|
-
declare function retry<T>(fn: (signal?: AbortSignal) => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
118
|
-
/**
|
|
119
|
-
* Returns a promise that resolves after the given number of milliseconds.
|
|
120
|
-
* @param ms The time to wait in milliseconds.
|
|
121
|
-
*/
|
|
122
|
-
declare function wait(ms: number): Promise<boolean>;
|
|
123
|
-
|
|
124
|
-
type async_RetryOptions = RetryOptions;
|
|
125
|
-
declare const async_retry: typeof retry;
|
|
126
|
-
declare const async_wait: typeof wait;
|
|
127
|
-
declare namespace async {
|
|
128
|
-
export { type async_RetryOptions as RetryOptions, async_retry as retry, async_wait as wait };
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
interface MemoizedFunction<T extends (...args: any[]) => any> {
|
|
132
|
-
(...args: Parameters<T>): ReturnType<T>;
|
|
133
|
-
/** Clears the cache. */
|
|
134
|
-
clear: () => void;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Memoizes a function by caching its results based on the input arguments.
|
|
138
|
-
* A resolver function can be provided to customize the key generation.
|
|
139
|
-
* If no resolver is provided, the key will be generated by JSON stringify-ing the input arguments.
|
|
140
|
-
* @param fn The function to memoize.
|
|
141
|
-
* @param resolver An optional resolver function to customize the key generation.
|
|
142
|
-
* @example
|
|
143
|
-
* // 1. Basic usage
|
|
144
|
-
* const heavyCalc = memoize((n: number) => {
|
|
145
|
-
* console.log('Calculating...');
|
|
146
|
-
* return n * 2;
|
|
147
|
-
* });
|
|
148
|
-
* heavyCalc(5); // Logs 'Calculating...' and returns 10
|
|
149
|
-
* heavyCalc(5); // Returns 10 immediately from cache
|
|
150
|
-
* @example
|
|
151
|
-
* // 2. Using maxAge (TTL)
|
|
152
|
-
* const getStockPrice = memoize(fetchPrice, { maxAge: 60000 }); // 1 minute cache
|
|
153
|
-
* @example
|
|
154
|
-
* // 3. Using a custom resolver
|
|
155
|
-
* const getUser = memoize(
|
|
156
|
-
* (user, theme) => render(user, theme),
|
|
157
|
-
* { resolver: (user) => user.id } // Only cache based on ID, ignore theme
|
|
158
|
-
* );
|
|
159
|
-
* @example
|
|
160
|
-
* // 4. Manual cache clearing
|
|
161
|
-
* heavyCalc.clear();
|
|
162
|
-
*/
|
|
163
|
-
declare function memoize<T extends (...args: any[]) => any>(fn: T, options?: {
|
|
164
|
-
/** Function to generate a cache key from the input arguments. */
|
|
165
|
-
resolver?: (...args: Parameters<T>) => string;
|
|
166
|
-
/** The time to wait in milliseconds before expiring a cache entry. */
|
|
167
|
-
maxAge?: number;
|
|
168
|
-
}): MemoizedFunction<T>;
|
|
169
|
-
|
|
170
|
-
type fn_MemoizedFunction<T extends (...args: any[]) => any> = MemoizedFunction<T>;
|
|
171
|
-
declare const fn_memoize: typeof memoize;
|
|
172
|
-
declare namespace fn {
|
|
173
|
-
export { type fn_MemoizedFunction as MemoizedFunction, fn_memoize as memoize };
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
interface DateOptions {
|
|
177
|
-
/** The reference timestamp to calculate from. Defaults to Date.now() */
|
|
178
|
-
since?: number | Date;
|
|
179
|
-
/** If true, returns null if the target time is in the past. */
|
|
180
|
-
nullIfPast?: boolean;
|
|
181
|
-
/** If true, omits the " ago" suffix for past dates. */
|
|
182
|
-
ignorePast?: boolean;
|
|
183
|
-
}
|
|
184
|
-
interface ParseOptions {
|
|
185
|
-
/** Return value in seconds instead of milliseconds. */
|
|
186
|
-
unit?: "ms" | "s";
|
|
187
|
-
/** If true, returns the absolute Unix timestamp (Date.now() + result). */
|
|
188
|
-
fromNow?: boolean;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Duration formatter.
|
|
192
|
-
*
|
|
193
|
-
* Available styles:
|
|
194
|
-
* - Digital (00:00)
|
|
195
|
-
* - HMS
|
|
196
|
-
* - YMDHMS.
|
|
197
|
-
* @param target The target time to calculate from.
|
|
198
|
-
* @param style The output style to use.
|
|
199
|
-
* @param options Formatting options.
|
|
200
|
-
*/
|
|
201
|
-
declare function duration(target: number | Date, style?: "digital" | "hms" | "ymdhms", options?: DateOptions): string | null;
|
|
202
|
-
/**
|
|
203
|
-
* Formats a date or timestamp into a human-readable relative string (e.g., "3 days ago").
|
|
204
|
-
* @param date - The Date object or timestamp to compare.
|
|
205
|
-
* @param locale - The BCP 47 language tag.
|
|
206
|
-
*/
|
|
207
|
-
declare function eta(date: Date | number, locale?: Intl.LocalesArgument): string;
|
|
208
|
-
/**
|
|
209
|
-
* Calculates the age of a person based on their birthdate.
|
|
210
|
-
* @param birthdate The birthdate of the person.
|
|
211
|
-
* */
|
|
212
|
-
declare function getAge(birthdate: Date): number;
|
|
213
|
-
/**
|
|
214
|
-
* Parses shorthand strings (1h 30m) into milliseconds or seconds.
|
|
215
|
-
*/
|
|
216
|
-
declare function parse(str: string | number, options?: ParseOptions): number;
|
|
217
|
-
|
|
218
|
-
type date_DateOptions = DateOptions;
|
|
219
|
-
type date_ParseOptions = ParseOptions;
|
|
220
|
-
declare const date_duration: typeof duration;
|
|
221
|
-
declare const date_eta: typeof eta;
|
|
222
|
-
declare const date_getAge: typeof getAge;
|
|
223
|
-
declare const date_parse: typeof parse;
|
|
224
|
-
declare namespace date {
|
|
225
|
-
export { type date_DateOptions as DateOptions, type date_ParseOptions as ParseOptions, date_duration as duration, date_eta as eta, date_getAge as getAge, date_parse as parse };
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Formats a number as a currency string using international standards.
|
|
230
|
-
* @param num - The number to process.
|
|
231
|
-
* @param options - Formatting options.
|
|
232
|
-
* @example
|
|
233
|
-
* currency(1234.5); // "$1,234.50"
|
|
234
|
-
* currency(1234.5, 'EUR', 'de-DE'); // "1.234,50 €"
|
|
235
|
-
* currency(500, 'JPY'); // "¥500" (Yen has no decimals)
|
|
236
|
-
*/
|
|
237
|
-
declare function currency(num: number, options?: {
|
|
238
|
-
/** The ISO currency code (e.g., 'USD', 'EUR', 'GBP'). */
|
|
239
|
-
currency?: string;
|
|
240
|
-
/** The BCP 47 language tag. */
|
|
241
|
-
locale?: Intl.LocalesArgument;
|
|
242
|
-
}): string;
|
|
243
|
-
/**
|
|
244
|
-
* Formats a number with thousands separators and optional decimal precision.
|
|
245
|
-
* @param num - The number to process.
|
|
246
|
-
* @param options - Formatting options.
|
|
247
|
-
* @example
|
|
248
|
-
* num(1000000); // "1,000,000" (en-US default)
|
|
249
|
-
* num(1000, { locale: 'de-DE' }); // "1.000"
|
|
250
|
-
* num(1234.567, { precision: 2 }); // "1,234.57"
|
|
251
|
-
*/
|
|
252
|
-
declare function number(num: number, options?: {
|
|
253
|
-
/** The BCP 47 language tag. */
|
|
254
|
-
locale?: Intl.LocalesArgument;
|
|
255
|
-
precision?: number;
|
|
256
|
-
}): string;
|
|
257
|
-
declare function memory(bytes: number, decimals?: number, units?: string[]): string;
|
|
258
|
-
/**
|
|
259
|
-
* Formats a number to an ordinal (e.g., 1st, 2nd, 3rd).
|
|
260
|
-
* @param num The number to process.
|
|
261
|
-
* @param locale The BCP 47 language tag.
|
|
262
|
-
*/
|
|
263
|
-
declare function ordinal(num: number | string, locale?: Intl.LocalesArgument): string;
|
|
264
|
-
/**
|
|
265
|
-
* Formats a number into a compact, human-readable string (e.g., 1.2k, 1M).
|
|
266
|
-
* @param num - The number to process.
|
|
267
|
-
* @param locale - The BCP 47 language tag.
|
|
268
|
-
*/
|
|
269
|
-
declare function compactNumber(num: number, locale?: Intl.LocalesArgument): string;
|
|
270
|
-
|
|
271
|
-
declare const format_compactNumber: typeof compactNumber;
|
|
272
|
-
declare const format_currency: typeof currency;
|
|
273
|
-
declare const format_memory: typeof memory;
|
|
274
|
-
declare const format_number: typeof number;
|
|
275
|
-
declare const format_ordinal: typeof ordinal;
|
|
276
|
-
declare namespace format {
|
|
277
|
-
export { format_compactNumber as compactNumber, format_currency as currency, format_memory as memory, format_number as number, format_ordinal as ordinal };
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
interface ReadDirOptions {
|
|
281
|
-
/** Whether to scan subdirectories. [default: true] */
|
|
282
|
-
recursive?: boolean;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Recursively (or shallowly) scans a directory and returns an array of relative file paths.
|
|
286
|
-
* @param path The path to the directory.
|
|
287
|
-
* @param options Options for the readDir function.
|
|
288
|
-
*/
|
|
289
|
-
declare function readDir(path: string, options?: ReadDirOptions): string[];
|
|
290
|
-
|
|
291
|
-
type fs_ReadDirOptions = ReadDirOptions;
|
|
292
|
-
declare const fs_readDir: typeof readDir;
|
|
293
|
-
declare namespace fs {
|
|
294
|
-
export { type fs_ReadDirOptions as ReadDirOptions, fs_readDir as readDir };
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Checks if a value is defined (not null or undefined).
|
|
299
|
-
*/
|
|
300
|
-
declare function defined<T>(val: T | undefined | null): val is T;
|
|
301
|
-
/**
|
|
302
|
-
* Checks if a value is an empty object, array, or string.
|
|
303
|
-
*/
|
|
304
|
-
declare function empty(val: unknown): boolean;
|
|
305
|
-
/**
|
|
306
|
-
* Checks if a number is within a specified range.
|
|
307
|
-
* @param num The number to check.
|
|
308
|
-
* @param min The minimum or maximum value of the range.
|
|
309
|
-
* @param max The maximum value of the range (optional).
|
|
310
|
-
*/
|
|
311
|
-
declare function inRange(num: number, max: number): boolean;
|
|
312
|
-
declare function inRange(num: number, min: number, max: number): boolean;
|
|
313
|
-
/**
|
|
314
|
-
* Checks if a value is a plain object (not an array, null, or function).
|
|
315
|
-
*/
|
|
316
|
-
declare function object(val: unknown): val is Record<string, any>;
|
|
317
|
-
/**
|
|
318
|
-
* Checks if an array is sorted.
|
|
319
|
-
*/
|
|
320
|
-
declare function sorted<T>(arr: T[], comparator?: (a: T, b: T) => number): boolean;
|
|
321
|
-
/**
|
|
322
|
-
* Checks if a value is a string.
|
|
323
|
-
*/
|
|
324
|
-
declare function string(val: unknown): val is string;
|
|
325
|
-
/**
|
|
326
|
-
* Checks if a date is today.
|
|
327
|
-
*/
|
|
328
|
-
declare function today(date: number | Date): boolean;
|
|
329
|
-
|
|
330
|
-
declare const is_defined: typeof defined;
|
|
331
|
-
declare const is_empty: typeof empty;
|
|
332
|
-
declare const is_inRange: typeof inRange;
|
|
333
|
-
declare const is_object: typeof object;
|
|
334
|
-
declare const is_sorted: typeof sorted;
|
|
335
|
-
declare const is_string: typeof string;
|
|
336
|
-
declare const is_today: typeof today;
|
|
337
|
-
declare namespace is {
|
|
338
|
-
export { is_defined as defined, is_empty as empty, is_inRange as inRange, is_object as object, is_sorted as sorted, is_string as string, is_today as today };
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Clamps a number within a specified range.
|
|
343
|
-
* @param num The number to check.
|
|
344
|
-
* @param min The minimum or maximum value of the range.
|
|
345
|
-
* @param max The maximum value of the range (optional).
|
|
346
|
-
*/
|
|
347
|
-
declare function clamp(num: number, max: number): number;
|
|
348
|
-
declare function clamp(num: number, min: number, max: number): number;
|
|
349
|
-
/**
|
|
350
|
-
* Calculates the interpolation factor (0-1) of a value between two points.
|
|
351
|
-
* @param start - The starting value (0%).
|
|
352
|
-
* @param end - The ending value (100%).
|
|
353
|
-
* @param value - The value to interpolate.
|
|
354
|
-
* @example
|
|
355
|
-
* invLerp(0, 100, 50); // 0.5
|
|
356
|
-
*/
|
|
357
|
-
declare function invLerp(start: number, end: number, value: number): number;
|
|
358
|
-
/**
|
|
359
|
-
* Linearly interpolates between two values.
|
|
360
|
-
* @param start - The starting value (0%).
|
|
361
|
-
* @param end - The ending value (100%).
|
|
362
|
-
* @param t - The interpolation factor (0 to 1).
|
|
363
|
-
* @example
|
|
364
|
-
* lerp(0, 100, 0.5); // 50
|
|
365
|
-
* lerp(10, 20, 0.2); // 12
|
|
366
|
-
*/
|
|
367
|
-
declare function lerp(start: number, end: number, t: number): number;
|
|
368
|
-
/**
|
|
369
|
-
* Converts seconds to milliseconds and rounds it to the nearest integer.
|
|
370
|
-
* @param num The number of seconds to convert.
|
|
371
|
-
*/
|
|
372
|
-
declare function ms(num: number): number;
|
|
373
|
-
/**
|
|
374
|
-
* Calculates the percentage value between two numbers.
|
|
375
|
-
* @param a The numerator.
|
|
376
|
-
* @param b The denominator.
|
|
377
|
-
* @param round Whether to round the result to the nearest integer.
|
|
378
|
-
* @example
|
|
379
|
-
* percent(50, 100) --> 50 // 50%
|
|
380
|
-
* percent(30, 40) --> 75 // 75%
|
|
381
|
-
*/
|
|
382
|
-
declare function percent(a: number, b: number, round?: boolean): number;
|
|
383
|
-
/**
|
|
384
|
-
* Maps a value from one range to another.
|
|
385
|
-
* @param value - The value to map.
|
|
386
|
-
* @param inMin - The minimum value of the input range.
|
|
387
|
-
* @param inMax - The maximum value of the input range.
|
|
388
|
-
* @param outMin - The minimum value of the output range.
|
|
389
|
-
* @param outMax - The maximum value of the output range.
|
|
390
|
-
* @example
|
|
391
|
-
* // Convert mouse X position (0-1920) to a volume level (0-1)
|
|
392
|
-
* const volume = remap(mouseX, 0, 1920, 0, 1);
|
|
393
|
-
*/
|
|
394
|
-
declare function remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
395
|
-
/**
|
|
396
|
-
* Converts milliseconds to seconds and rounds it to the nearest integer.
|
|
397
|
-
* @param num The number of milliseconds to convert.
|
|
398
|
-
*/
|
|
399
|
-
declare function secs(num: number): number;
|
|
400
|
-
/**
|
|
401
|
-
* Returns the sum of an array of numbers. Negative values subtract from the total.
|
|
402
|
-
* @param array The array to sum.
|
|
403
|
-
* @param selector Function that selects the item's weight.
|
|
404
|
-
* @param ignoreNaN If true, NaN values will not throw an error.
|
|
405
|
-
*/
|
|
406
|
-
declare function sum<T>(array: T[], selector?: (item: T) => number): number;
|
|
407
|
-
/**
|
|
408
|
-
* Wraps a number into a modular range.
|
|
409
|
-
* @param num The value to wrap.
|
|
410
|
-
* @param max The upper bound.
|
|
411
|
-
* @example
|
|
412
|
-
* ```ts
|
|
413
|
-
* wrap(12, 10); // 2
|
|
414
|
-
* wrap(-1, 10); // 9 (last index)
|
|
415
|
-
* ```
|
|
416
|
-
*/
|
|
417
|
-
declare function wrap(num: number, max: number): number;
|
|
418
|
-
|
|
419
|
-
declare const math_clamp: typeof clamp;
|
|
420
|
-
declare const math_invLerp: typeof invLerp;
|
|
421
|
-
declare const math_lerp: typeof lerp;
|
|
422
|
-
declare const math_ms: typeof ms;
|
|
423
|
-
declare const math_percent: typeof percent;
|
|
424
|
-
declare const math_remap: typeof remap;
|
|
425
|
-
declare const math_secs: typeof secs;
|
|
426
|
-
declare const math_sum: typeof sum;
|
|
427
|
-
declare const math_wrap: typeof wrap;
|
|
428
|
-
declare namespace math {
|
|
429
|
-
export { math_clamp as clamp, math_invLerp as invLerp, math_lerp as lerp, math_ms as ms, math_percent as percent, math_remap as remap, math_secs as secs, math_sum as sum, math_wrap as wrap };
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Retrieves a nested property.
|
|
434
|
-
* @param obj The object to process.
|
|
435
|
-
* @param path The path to retrieve (e.g., 'data.users[0].id').
|
|
436
|
-
* @param defaultValue The default value to return if the property does not exist.
|
|
437
|
-
*/
|
|
438
|
-
declare function get<T = any>(obj: Record<string, any>, path: string, defaultValue?: T): T;
|
|
439
|
-
/**
|
|
440
|
-
* Checks if a nested path exists within an object.
|
|
441
|
-
* @param obj The object to process.
|
|
442
|
-
* @param path The path string (e.g., 'data.users[0].id').
|
|
443
|
-
*/
|
|
444
|
-
declare function has(obj: Record<string, any>, path: string): boolean;
|
|
445
|
-
/**
|
|
446
|
-
* Sets a nested property value. Creates missing objects/arrays along the path.
|
|
447
|
-
* @param obj The object to process.
|
|
448
|
-
* @param path The path to set (e.g., 'data.users[0].id').
|
|
449
|
-
* @param value The value to inject.
|
|
450
|
-
*/
|
|
451
|
-
declare function set(obj: Record<string, any>, path: string, value: any): void;
|
|
452
|
-
/**
|
|
453
|
-
* Deep merges multiple objects.
|
|
454
|
-
* @param target - The base object to merge into.
|
|
455
|
-
* @param sources - One or more objects to merge.
|
|
456
|
-
*/
|
|
457
|
-
declare function merge<T, S1>(target: T, s1: S1): T & S1;
|
|
458
|
-
declare function merge<T, S1, S2>(target: T, s1: S1, s2: S2): T & S1 & S2;
|
|
459
|
-
declare function merge<T, S1, S2, S3>(target: T, s1: S1, s2: S2, s3: S3): T & S1 & S2 & S3;
|
|
460
|
-
declare function merge(target: any, ...sources: any[]): any;
|
|
461
|
-
/**
|
|
462
|
-
* Creates an object composed of the picked object properties.
|
|
463
|
-
* @param obj The object to process.
|
|
464
|
-
* @param keys The keys to pick from the object.
|
|
465
|
-
*/
|
|
466
|
-
declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
467
|
-
/**
|
|
468
|
-
* Creates an object composed of the omitted object properties.
|
|
469
|
-
* @param obj The object to process.
|
|
470
|
-
* @param keys The keys to omit from the object.
|
|
471
|
-
*/
|
|
472
|
-
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
473
|
-
|
|
474
|
-
declare const obj_get: typeof get;
|
|
475
|
-
declare const obj_has: typeof has;
|
|
476
|
-
declare const obj_merge: typeof merge;
|
|
477
|
-
declare const obj_omit: typeof omit;
|
|
478
|
-
declare const obj_pick: typeof pick;
|
|
479
|
-
declare const obj_set: typeof set;
|
|
480
|
-
declare namespace obj {
|
|
481
|
-
export { obj_get as get, obj_has as has, obj_merge as merge, obj_omit as omit, obj_pick as pick, obj_set as set };
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
type AlphaCasing = "lower" | "upper" | "mixed";
|
|
485
|
-
interface RndArrayOptions<T> {
|
|
486
|
-
/** Optional seed for RNG. */
|
|
487
|
-
seed?: number;
|
|
488
|
-
/** Reroll if the result is equal to this value. */
|
|
489
|
-
not?: ((item: T) => boolean) | (T | null | undefined);
|
|
490
|
-
/** Maximum number of times to reroll if `not` is specified. [default: 10] */
|
|
491
|
-
maxRerolls?: number;
|
|
492
|
-
}
|
|
493
|
-
interface RndStrOptions {
|
|
494
|
-
/** Optional seed for RNG. */
|
|
495
|
-
seed?: number;
|
|
496
|
-
/** Character casing mode. */
|
|
497
|
-
casing?: AlphaCasing;
|
|
498
|
-
/** Custom character pool. */
|
|
499
|
-
customChars?: string;
|
|
500
|
-
/** Characters to exclude from the pool. */
|
|
501
|
-
exclude?: string | string[];
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Returns true based on a percentage probability.
|
|
505
|
-
* @param percent A value between 0 and 1. [default: 0.5]
|
|
506
|
-
* @param seed Optional seed for RNG.
|
|
507
|
-
*/
|
|
508
|
-
declare function chance(percent?: number, seed?: number): boolean;
|
|
509
|
-
/**
|
|
510
|
-
* Returns a random item from the given array.
|
|
511
|
-
* @param array Array of items to choose from.
|
|
512
|
-
* @param options Options for the choice function.
|
|
513
|
-
*/
|
|
514
|
-
declare function choice<T>(array: T[], options?: RndArrayOptions<T>): T;
|
|
515
|
-
/**
|
|
516
|
-
* Returns a random item from the given array based on their corresponding weights.
|
|
517
|
-
* @param array Array of items to choose from.
|
|
518
|
-
* @param selector Function that selects the item's weight.
|
|
519
|
-
* @param seed Optional seed for RNG.
|
|
520
|
-
*/
|
|
521
|
-
declare function weighted<T>(array: T[], selector: (item: T) => number, seed?: number): T;
|
|
522
|
-
/**
|
|
523
|
-
* Returns an object with a single method, `pick`, which returns a random item from the given array in O(1) time.
|
|
524
|
-
* The probability of each item being picked is determined by the corresponding weight in the `weights` array.
|
|
525
|
-
* @param items Array of items to choose from.
|
|
526
|
-
* @param selector Function that selects the item's weight.
|
|
527
|
-
* @param seed Optional seed for RNG.
|
|
528
|
-
*/
|
|
529
|
-
declare function sampler<T>(items: T[], selector: (item: T) => number, seed?: number): {
|
|
530
|
-
/**
|
|
531
|
-
* Returns a random item from the given array in O(1) time.
|
|
532
|
-
* @param seed Optional seed for RNG.
|
|
533
|
-
*/
|
|
534
|
-
pick: (seed?: number) => T | undefined;
|
|
535
|
-
};
|
|
536
|
-
/**
|
|
537
|
-
* Creates a deterministic pseudo-random number generator (PRNG) using the Mulberry32 algorithm.
|
|
538
|
-
* @param seed An integer seed value.
|
|
539
|
-
* @example
|
|
540
|
-
* const rng = prng(123);
|
|
541
|
-
* const val1 = rng(); // Always the same for seed 123
|
|
542
|
-
*/
|
|
543
|
-
declare function prng(seed: number): () => number;
|
|
544
|
-
/**
|
|
545
|
-
* Generates a random float between the given minimum and maximum values.
|
|
546
|
-
* @param min The minimum value (inclusive) for the random float.
|
|
547
|
-
* @param max The maximum value (inclusive) for the random float.
|
|
548
|
-
* @param seed Optional seed for RNG.
|
|
549
|
-
*/
|
|
550
|
-
declare function float(min: number, max: number, seed?: number): number;
|
|
551
|
-
/**
|
|
552
|
-
* Returns a random index from the given array.
|
|
553
|
-
* @param array The array to generate an index for.
|
|
554
|
-
* @param options Options for the index function.
|
|
555
|
-
*/
|
|
556
|
-
declare function index<T>(array: T[], options?: RndArrayOptions<number>): number;
|
|
557
|
-
/**
|
|
558
|
-
* Generates a random integer between the given minimum and maximum values.
|
|
559
|
-
* @param min The minimum value (inclusive) for the random integer.
|
|
560
|
-
* @param max The maximum value (inclusive) for the random integer.
|
|
561
|
-
* @param seed Optional seed for RNG.
|
|
562
|
-
*/
|
|
563
|
-
declare function int(min: number, max: number, seed?: number): number;
|
|
564
|
-
/**
|
|
565
|
-
* Generates a random string of the given length using the specified character pool.
|
|
566
|
-
* @param len The length of the random string.
|
|
567
|
-
* @param mode The character pool to use. Can be "number", "alpha", "alphanumeric", or "custom".
|
|
568
|
-
* @param options Options for the rndStr function.
|
|
569
|
-
*/
|
|
570
|
-
declare function str$1(len: number, mode: "number" | "alpha" | "alphanumeric" | "custom", options?: RndStrOptions): string;
|
|
571
|
-
|
|
572
|
-
type rnd_AlphaCasing = AlphaCasing;
|
|
573
|
-
type rnd_RndArrayOptions<T> = RndArrayOptions<T>;
|
|
574
|
-
type rnd_RndStrOptions = RndStrOptions;
|
|
575
|
-
declare const rnd_chance: typeof chance;
|
|
576
|
-
declare const rnd_choice: typeof choice;
|
|
577
|
-
declare const rnd_float: typeof float;
|
|
578
|
-
declare const rnd_index: typeof index;
|
|
579
|
-
declare const rnd_int: typeof int;
|
|
580
|
-
declare const rnd_prng: typeof prng;
|
|
581
|
-
declare const rnd_sampler: typeof sampler;
|
|
582
|
-
declare const rnd_weighted: typeof weighted;
|
|
583
|
-
declare namespace rnd {
|
|
584
|
-
export { type rnd_AlphaCasing as AlphaCasing, type rnd_RndArrayOptions as RndArrayOptions, type rnd_RndStrOptions as RndStrOptions, rnd_chance as chance, rnd_choice as choice, rnd_float as float, rnd_index as index, rnd_int as int, rnd_prng as prng, rnd_sampler as sampler, str$1 as str, rnd_weighted as weighted };
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Escapes regex characters in the given string.
|
|
589
|
-
* @param str - The string to process.
|
|
590
|
-
*/
|
|
591
|
-
declare function escapeRegex(str: string): string;
|
|
592
|
-
/**
|
|
593
|
-
* Retrieves a substring following a specific flag.
|
|
594
|
-
* @param str The string to process.
|
|
595
|
-
* @param flag A string or regex to look for.
|
|
596
|
-
*/
|
|
597
|
-
declare function getFlag(str: string, flag: string | RegExp, length?: number): string | null;
|
|
598
|
-
/**
|
|
599
|
-
* Checks if a string contains a specific flag.
|
|
600
|
-
* @param str The string to process.
|
|
601
|
-
* @param flag A string or regex to look for.
|
|
602
|
-
*/
|
|
603
|
-
declare function hasFlag(str: string, flag: string | RegExp): boolean;
|
|
604
|
-
/**
|
|
605
|
-
* Formats a string to Title Case, optionally keeping acronyms and skipping minor words (the, and, of, etc.).
|
|
606
|
-
* @param str The string to process.
|
|
607
|
-
* @param smart If true, will keep acronyms and skip minor words. [default: true]
|
|
608
|
-
*/
|
|
609
|
-
declare function toTitleCase(str: string, smart?: boolean): string;
|
|
610
|
-
|
|
611
|
-
declare const str_escapeRegex: typeof escapeRegex;
|
|
612
|
-
declare const str_getFlag: typeof getFlag;
|
|
613
|
-
declare const str_hasFlag: typeof hasFlag;
|
|
614
|
-
declare const str_toTitleCase: typeof toTitleCase;
|
|
615
|
-
declare namespace str {
|
|
616
|
-
export { str_escapeRegex as escapeRegex, str_getFlag as getFlag, str_hasFlag as hasFlag, str_toTitleCase as toTitleCase };
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
interface DebouncedFunction<T extends (...args: any[]) => any> {
|
|
620
|
-
(...args: Parameters<T>): void;
|
|
621
|
-
/** Cancels the debounced function. */
|
|
622
|
-
cancel: () => void;
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Only executes after 'wait' ms have passed since the last call.
|
|
626
|
-
* @param fn The function to debounce.
|
|
627
|
-
* @param wait The time to wait in milliseconds.
|
|
628
|
-
* @param options Options for the debounce function.
|
|
629
|
-
* @example
|
|
630
|
-
* const search = debounce((str) => console.log("Searching:", str), 500);
|
|
631
|
-
* // Even if called rapidly, it only logs once 500ms after the last call.
|
|
632
|
-
* search('a');
|
|
633
|
-
* search('ab');
|
|
634
|
-
* search('abc'); // Only 'abc' will be logged.
|
|
635
|
-
* // Cancel a pending execution
|
|
636
|
-
* search.cancel();
|
|
637
|
-
*/
|
|
638
|
-
declare function debounce<T extends (...args: any[]) => any>(fn: T, wait: number, options?: {
|
|
639
|
-
/** Calls the function immediately on the leading edge. */
|
|
640
|
-
immediate?: boolean;
|
|
641
|
-
}): DebouncedFunction<T>;
|
|
642
|
-
/**
|
|
643
|
-
* Executes at most once every 'limit' ms.
|
|
644
|
-
* @param fn The function to throttle.
|
|
645
|
-
* @param limit The time to wait in milliseconds.
|
|
646
|
-
* @example
|
|
647
|
-
* const handleScroll = throttle(() => console.log('Scroll position:', window.scrollY), 200);
|
|
648
|
-
* // Even if the browser fires 100 scroll events per second,
|
|
649
|
-
* // this function will only execute once every 200ms.
|
|
650
|
-
* window.addEventListener('scroll', handleScroll);
|
|
651
|
-
*/
|
|
652
|
-
declare function throttle<T extends (...args: any[]) => any>(fn: T, limit: number): (...args: Parameters<T>) => void;
|
|
653
|
-
|
|
654
|
-
type timing_DebouncedFunction<T extends (...args: any[]) => any> = DebouncedFunction<T>;
|
|
655
|
-
declare const timing_debounce: typeof debounce;
|
|
656
|
-
declare const timing_throttle: typeof throttle;
|
|
657
|
-
declare namespace timing {
|
|
658
|
-
export { type timing_DebouncedFunction as DebouncedFunction, timing_debounce as debounce, timing_throttle as throttle };
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
type ToRecordContext<T, V> = {
|
|
662
|
-
index: number;
|
|
663
|
-
lastValue: V | undefined;
|
|
664
|
-
newRecord: Readonly<Record<string | number, V>>;
|
|
665
|
-
originalArray: ReadonlyArray<T>;
|
|
666
|
-
};
|
|
667
|
-
/**
|
|
668
|
-
* Transforms an array into a object record with access to the object as it's being built.
|
|
669
|
-
* @param array Array to process.
|
|
670
|
-
* @param callback Function to map over the array.
|
|
671
|
-
*/
|
|
672
|
-
declare function record<T, V>(array: ReadonlyArray<T>, callback: (item: T, context: ToRecordContext<T, V>) => {
|
|
673
|
-
key: string | number;
|
|
674
|
-
value: V;
|
|
675
|
-
}): Record<string | number, V>;
|
|
676
|
-
|
|
677
|
-
type to_ToRecordContext<T, V> = ToRecordContext<T, V>;
|
|
678
|
-
declare const to_record: typeof record;
|
|
679
|
-
declare namespace to {
|
|
680
|
-
export { type to_ToRecordContext as ToRecordContext, to_record as record };
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Pipes a value through a series of functions.
|
|
685
|
-
* Each function takes the output of the previous one.
|
|
686
|
-
*/
|
|
687
|
-
declare function Pipe<A>(value: A): A;
|
|
688
|
-
declare function Pipe<A, B>(value: A, fn1: (arg: A) => B): B;
|
|
689
|
-
declare function Pipe<A, B, C>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C): C;
|
|
690
|
-
declare function Pipe<A, B, C, D>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D): D;
|
|
691
|
-
declare function Pipe<A, B, C, D, E>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E): E;
|
|
692
|
-
declare function Pipe<A, B, C, D, E, F>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F): F;
|
|
693
|
-
declare function Pipe<A, B, C, D, E, F, G>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F, fn6: (arg: F) => G): G;
|
|
694
|
-
declare function Pipe<A, B, C, D, E, F, G, H>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F, fn6: (arg: F) => G, fn7: (arg: G) => H): H;
|
|
695
|
-
declare function Pipe<A, B, C, D, E, F, G, H, I>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F, fn6: (arg: F) => G, fn7: (arg: G) => H, fn8: (arg: H) => I): I;
|
|
696
|
-
declare function Pipe<A, B, C, D, E, F, G, H, I, J>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F, fn6: (arg: F) => G, fn7: (arg: G) => H, fn8: (arg: H) => I, fn9: (arg: I) => J): J;
|
|
697
|
-
declare function Pipe<A, B, C, D, E, F, G, H, I, J, K>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D, fn4: (arg: D) => E, fn5: (arg: E) => F, fn6: (arg: F) => G, fn7: (arg: G) => H, fn8: (arg: H) => I, fn9: (arg: I) => J, fn10: (arg: J) => K): K;
|
|
698
|
-
|
|
699
|
-
declare class Storage {
|
|
700
|
-
private isNode;
|
|
701
|
-
private filePath;
|
|
702
|
-
private memoryCache;
|
|
703
|
-
private loadFromFile;
|
|
704
|
-
private persist;
|
|
705
|
-
/**
|
|
706
|
-
* A lightweight, high-performant persistent storage system.
|
|
707
|
-
* Uses JSON files in Node.js, localStorage in the browser.
|
|
708
|
-
* @param fileName Only used in Node.js to create a persistent .json file.
|
|
709
|
-
* @param directory The directory for the file. Defaults to current working directory.
|
|
710
|
-
*/
|
|
711
|
-
constructor(fileName?: string, directory?: string);
|
|
712
|
-
has(key: string): boolean;
|
|
713
|
-
get<T>(key: string): T | null;
|
|
714
|
-
set<T>(key: string, value: T, ttl?: number): void;
|
|
715
|
-
remove(key: string): void;
|
|
716
|
-
clear(): void;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
declare class Cache<T> {
|
|
720
|
-
private cache;
|
|
721
|
-
private interval;
|
|
722
|
-
/**
|
|
723
|
-
* A lightweight, high-performant in-memory cache.
|
|
724
|
-
* Uses Map for O(1) lookups and an optional cleanup interval.
|
|
725
|
-
* @param cleanupMs The interval in milliseconds to run the cleanup function. [default: 60000 (1 minute)]
|
|
726
|
-
*/
|
|
727
|
-
constructor(cleanupMs?: number);
|
|
728
|
-
set(key: string | number, value: T, ttlMs?: number): void;
|
|
729
|
-
get(key: string | number): T | null;
|
|
730
|
-
private cleanup;
|
|
731
|
-
clear(): void;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
type AnyFunc = (...args: any) => any;
|
|
735
|
-
type DeepPartial<T> = {
|
|
736
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
737
|
-
};
|
|
738
|
-
type TypedEmitter<TEvents extends Record<string, any>> = {
|
|
739
|
-
on<K extends keyof TEvents>(event: K, listener: (...args: TEvents[K]) => void): any;
|
|
740
|
-
once<K extends keyof TEvents>(event: K, listener: (...args: TEvents[K]) => void): any;
|
|
741
|
-
off<K extends keyof TEvents>(event: K, listener: (...args: TEvents[K]) => void): any;
|
|
742
|
-
emit<K extends keyof TEvents>(event: K, ...args: TEvents[K]): boolean;
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
type LoopState = "running" | "paused" | "stopped";
|
|
746
|
-
interface LoopEvents<T> {
|
|
747
|
-
start: [];
|
|
748
|
-
tick: [result: T];
|
|
749
|
-
pause: [{
|
|
750
|
-
remaining: number;
|
|
751
|
-
}];
|
|
752
|
-
resume: [];
|
|
753
|
-
stop: [];
|
|
754
|
-
error: [error: any];
|
|
755
|
-
}
|
|
756
|
-
declare const TypedEmitterBase: {
|
|
757
|
-
new <T>(): TypedEmitter<LoopEvents<T>>;
|
|
758
|
-
};
|
|
759
|
-
declare class Loop<T = any> extends TypedEmitterBase<T> {
|
|
760
|
-
private _state;
|
|
761
|
-
private timeoutId;
|
|
762
|
-
private delay;
|
|
763
|
-
private fn;
|
|
764
|
-
private startTime;
|
|
765
|
-
private remaining;
|
|
766
|
-
private run;
|
|
767
|
-
private clearTimer;
|
|
768
|
-
/**
|
|
769
|
-
* Creates an interval. If the function is async, it will wait for it to complete before scheduling the next run.
|
|
770
|
-
* @param fn The function to run.
|
|
771
|
-
* @param delay The delay between runs in milliseconds.
|
|
772
|
-
* @param immediate Whether to start the loop immediately. [default: true]
|
|
773
|
-
*/
|
|
774
|
-
constructor(fn: (loop: Loop<T>) => Promise<T> | T, delay: number, immediate?: boolean);
|
|
775
|
-
get state(): LoopState;
|
|
776
|
-
/** Starts the loop. */
|
|
777
|
-
start(): void;
|
|
778
|
-
/** Resumes a paused loop. */
|
|
779
|
-
resume(): void;
|
|
780
|
-
/** Stops the loop. */
|
|
781
|
-
stop(): void;
|
|
782
|
-
/** Pauses the execution. */
|
|
783
|
-
pause(): void;
|
|
784
|
-
/**
|
|
785
|
-
* Sets the delay between runs
|
|
786
|
-
* @param ms The new delay in milliseconds.
|
|
787
|
-
*/
|
|
788
|
-
setDelay(ms: number): void;
|
|
789
|
-
/** Manually trigger the function once without affecting the loop. */
|
|
790
|
-
execute(): Promise<void>;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
declare const qznt: {
|
|
794
|
-
arr: typeof arr;
|
|
795
|
-
async: typeof async;
|
|
796
|
-
fn: typeof fn;
|
|
797
|
-
date: typeof date;
|
|
798
|
-
format: typeof format;
|
|
799
|
-
fs: typeof fs;
|
|
800
|
-
is: typeof is;
|
|
801
|
-
math: typeof math;
|
|
802
|
-
obj: typeof obj;
|
|
803
|
-
timing: typeof timing;
|
|
804
|
-
rnd: typeof rnd;
|
|
805
|
-
str: typeof str;
|
|
806
|
-
to: typeof to;
|
|
807
|
-
Pipe: typeof Pipe;
|
|
808
|
-
Storage: typeof Storage;
|
|
809
|
-
Cache: typeof Cache;
|
|
810
|
-
Loop: typeof Loop;
|
|
811
|
-
};
|
|
812
|
-
declare const $: {
|
|
813
|
-
arr: typeof arr;
|
|
814
|
-
async: typeof async;
|
|
815
|
-
fn: typeof fn;
|
|
816
|
-
date: typeof date;
|
|
817
|
-
format: typeof format;
|
|
818
|
-
fs: typeof fs;
|
|
819
|
-
is: typeof is;
|
|
820
|
-
math: typeof math;
|
|
821
|
-
obj: typeof obj;
|
|
822
|
-
timing: typeof timing;
|
|
823
|
-
rnd: typeof rnd;
|
|
824
|
-
str: typeof str;
|
|
825
|
-
to: typeof to;
|
|
826
|
-
Pipe: typeof Pipe;
|
|
827
|
-
Storage: typeof Storage;
|
|
828
|
-
Cache: typeof Cache;
|
|
829
|
-
Loop: typeof Loop;
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
export { $, type AlphaCasing, type AnyFunc, Cache, type DateOptions, type DebouncedFunction, type DeepPartial, Loop, type MemoizedFunction, type ParseOptions, Pipe, type ReadDirOptions, type RetryOptions, type RndArrayOptions, type RndStrOptions, type SequentialMapContext, Storage, type ToRecordContext, type TypedEmitter, chance, choice, chunk, chunkAdj, clamp, cluster, compact, compactNumber, currency, debounce, qznt as default, defined, duration, empty, escapeRegex, eta, float, forceArray, get, getAge, getFlag, has, hasFlag, inRange, index, int, invLerp, lerp, memoize, memory, merge, ms, number, object, omit, ordinal, parse, percent, pick, prng, readDir, record, remap, retry, sampler, search, secs, seqMap, set, shuffle, sortBy, sorted, str$1 as str, string, sum, throttle, toTitleCase, today, unique, wait, weighted, wrap };
|