qznt 1.0.35 → 1.0.37
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/dist/index.cjs +56 -11
- package/dist/{index.d.mts → index.d.cts} +39 -9
- package/dist/index.d.ts +39 -9
- package/dist/index.js +49 -6
- package/package.json +4 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
package/dist/index.cjs
CHANGED
|
@@ -54,6 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
float: () => float,
|
|
55
55
|
forceArray: () => forceArray,
|
|
56
56
|
get: () => get,
|
|
57
|
+
getAge: () => getAge,
|
|
57
58
|
getFlag: () => getFlag,
|
|
58
59
|
has: () => has,
|
|
59
60
|
hasFlag: () => hasFlag,
|
|
@@ -94,7 +95,8 @@ __export(index_exports, {
|
|
|
94
95
|
today: () => today,
|
|
95
96
|
unique: () => unique,
|
|
96
97
|
wait: () => wait,
|
|
97
|
-
weighted: () => weighted
|
|
98
|
+
weighted: () => weighted,
|
|
99
|
+
wrap: () => wrap
|
|
98
100
|
});
|
|
99
101
|
module.exports = __toCommonJS(index_exports);
|
|
100
102
|
|
|
@@ -388,13 +390,41 @@ __export(async_exports, {
|
|
|
388
390
|
retry: () => retry,
|
|
389
391
|
wait: () => wait
|
|
390
392
|
});
|
|
391
|
-
async function retry(fn,
|
|
393
|
+
async function retry(fn, options = {}) {
|
|
394
|
+
const { retries = 3, delay = 500, timeout, signal } = options;
|
|
395
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
396
|
+
const executeWithTimeout = async () => {
|
|
397
|
+
if (!timeout) return fn(signal);
|
|
398
|
+
const controller = new AbortController();
|
|
399
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
400
|
+
try {
|
|
401
|
+
return await fn(controller.signal);
|
|
402
|
+
} catch (err) {
|
|
403
|
+
if (controller.signal.aborted) throw new Error(`Attempt timed out after ${timeout}ms`);
|
|
404
|
+
throw err;
|
|
405
|
+
} finally {
|
|
406
|
+
clearTimeout(timer);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
392
409
|
try {
|
|
393
|
-
return await
|
|
410
|
+
return await executeWithTimeout();
|
|
394
411
|
} catch (error) {
|
|
412
|
+
if (signal?.aborted) throw error;
|
|
395
413
|
if (retries <= 0) throw error;
|
|
396
414
|
const jitter = Math.random() * 200;
|
|
397
|
-
|
|
415
|
+
const totalDelay = delay + jitter;
|
|
416
|
+
await new Promise((resolve, reject) => {
|
|
417
|
+
const timer = setTimeout(resolve, totalDelay);
|
|
418
|
+
signal?.addEventListener(
|
|
419
|
+
"abort",
|
|
420
|
+
() => {
|
|
421
|
+
clearTimeout(timer);
|
|
422
|
+
reject(new Error("Operation aborted"));
|
|
423
|
+
},
|
|
424
|
+
{ once: true }
|
|
425
|
+
);
|
|
426
|
+
});
|
|
427
|
+
return retry(fn, { ...options, retries: retries - 1, delay: delay * 2 });
|
|
398
428
|
}
|
|
399
429
|
}
|
|
400
430
|
function wait(ms2) {
|
|
@@ -436,6 +466,7 @@ var date_exports = {};
|
|
|
436
466
|
__export(date_exports, {
|
|
437
467
|
duration: () => duration,
|
|
438
468
|
eta: () => eta,
|
|
469
|
+
getAge: () => getAge,
|
|
439
470
|
parse: () => parse
|
|
440
471
|
});
|
|
441
472
|
var MS_MAP = {
|
|
@@ -494,6 +525,15 @@ function eta(date, locale) {
|
|
|
494
525
|
}
|
|
495
526
|
return "";
|
|
496
527
|
}
|
|
528
|
+
function getAge(birthdate) {
|
|
529
|
+
const today2 = /* @__PURE__ */ new Date();
|
|
530
|
+
let age = today2.getFullYear() - birthdate.getFullYear();
|
|
531
|
+
const monthDiff = today2.getMonth() - birthdate.getMonth();
|
|
532
|
+
if (monthDiff < 0 || monthDiff === 0 && today2.getDate() < birthdate.getDate()) {
|
|
533
|
+
age--;
|
|
534
|
+
}
|
|
535
|
+
return age;
|
|
536
|
+
}
|
|
497
537
|
function parse(str2, options = {}) {
|
|
498
538
|
if (typeof str2 === "number") return str2;
|
|
499
539
|
const matches = str2.matchAll(/(-?\d+)([a-z]+)/gi);
|
|
@@ -566,7 +606,7 @@ var fs_exports = {};
|
|
|
566
606
|
__export(fs_exports, {
|
|
567
607
|
readDir: () => readDir
|
|
568
608
|
});
|
|
569
|
-
var import_node_fs = __toESM(require("fs"));
|
|
609
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
570
610
|
var import_node_path = require("path");
|
|
571
611
|
function readDir(path2, options = {}) {
|
|
572
612
|
const { recursive = true } = options;
|
|
@@ -648,7 +688,8 @@ __export(math_exports, {
|
|
|
648
688
|
percent: () => percent,
|
|
649
689
|
remap: () => remap,
|
|
650
690
|
secs: () => secs,
|
|
651
|
-
sum: () => sum
|
|
691
|
+
sum: () => sum,
|
|
692
|
+
wrap: () => wrap
|
|
652
693
|
});
|
|
653
694
|
function clamp(num, a, b) {
|
|
654
695
|
let min = b !== void 0 ? a : 0;
|
|
@@ -686,6 +727,9 @@ function sum(array, selector) {
|
|
|
686
727
|
return (isNaN(b) ? 0 : b) < 0 ? a - -b : a + (b || 0);
|
|
687
728
|
}, 0);
|
|
688
729
|
}
|
|
730
|
+
function wrap(num, max) {
|
|
731
|
+
return (num % max + max) % max;
|
|
732
|
+
}
|
|
689
733
|
|
|
690
734
|
// src/obj.ts
|
|
691
735
|
var obj_exports = {};
|
|
@@ -888,8 +932,8 @@ function Pipe(value, ...fns) {
|
|
|
888
932
|
}
|
|
889
933
|
|
|
890
934
|
// src/Storage.ts
|
|
891
|
-
var import_node_fs2 = __toESM(require("fs"));
|
|
892
|
-
var import_node_path2 = __toESM(require("path"));
|
|
935
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
936
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
893
937
|
var Storage = class {
|
|
894
938
|
isNode = typeof window === "undefined";
|
|
895
939
|
filePath = null;
|
|
@@ -1025,7 +1069,7 @@ var Cache = class {
|
|
|
1025
1069
|
};
|
|
1026
1070
|
|
|
1027
1071
|
// src/Loop.ts
|
|
1028
|
-
var import_node_events = __toESM(require("events"));
|
|
1072
|
+
var import_node_events = __toESM(require("events"), 1);
|
|
1029
1073
|
var TypedEmitterBase = import_node_events.default;
|
|
1030
1074
|
var Loop = class extends TypedEmitterBase {
|
|
1031
1075
|
_state = "stopped";
|
|
@@ -1166,6 +1210,7 @@ var index_default = qznt;
|
|
|
1166
1210
|
float,
|
|
1167
1211
|
forceArray,
|
|
1168
1212
|
get,
|
|
1213
|
+
getAge,
|
|
1169
1214
|
getFlag,
|
|
1170
1215
|
has,
|
|
1171
1216
|
hasFlag,
|
|
@@ -1206,6 +1251,6 @@ var index_default = qznt;
|
|
|
1206
1251
|
today,
|
|
1207
1252
|
unique,
|
|
1208
1253
|
wait,
|
|
1209
|
-
weighted
|
|
1254
|
+
weighted,
|
|
1255
|
+
wrap
|
|
1210
1256
|
});
|
|
1211
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -97,23 +97,35 @@ declare namespace arr {
|
|
|
97
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
98
|
}
|
|
99
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
|
+
}
|
|
100
110
|
/**
|
|
101
|
-
* Retries an async function
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @param
|
|
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.
|
|
105
116
|
*/
|
|
106
|
-
declare function retry<T>(fn: () => Promise<T>,
|
|
117
|
+
declare function retry<T>(fn: (signal?: AbortSignal) => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
107
118
|
/**
|
|
108
119
|
* Returns a promise that resolves after the given number of milliseconds.
|
|
109
120
|
* @param ms The time to wait in milliseconds.
|
|
110
121
|
*/
|
|
111
122
|
declare function wait(ms: number): Promise<boolean>;
|
|
112
123
|
|
|
124
|
+
type async_RetryOptions = RetryOptions;
|
|
113
125
|
declare const async_retry: typeof retry;
|
|
114
126
|
declare const async_wait: typeof wait;
|
|
115
127
|
declare namespace async {
|
|
116
|
-
export { async_retry as retry, async_wait as wait };
|
|
128
|
+
export { type async_RetryOptions as RetryOptions, async_retry as retry, async_wait as wait };
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
interface MemoizedFunction<T extends (...args: any[]) => any> {
|
|
@@ -193,6 +205,11 @@ declare function duration(target: number | Date, style?: "digital" | "hms" | "ym
|
|
|
193
205
|
* @param locale - The BCP 47 language tag.
|
|
194
206
|
*/
|
|
195
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;
|
|
196
213
|
/**
|
|
197
214
|
* Parses shorthand strings (1h 30m) into milliseconds or seconds.
|
|
198
215
|
*/
|
|
@@ -202,9 +219,10 @@ type date_DateOptions = DateOptions;
|
|
|
202
219
|
type date_ParseOptions = ParseOptions;
|
|
203
220
|
declare const date_duration: typeof duration;
|
|
204
221
|
declare const date_eta: typeof eta;
|
|
222
|
+
declare const date_getAge: typeof getAge;
|
|
205
223
|
declare const date_parse: typeof parse;
|
|
206
224
|
declare namespace date {
|
|
207
|
-
export { type date_DateOptions as DateOptions, type date_ParseOptions as ParseOptions, date_duration as duration, date_eta as eta, date_parse as parse };
|
|
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 };
|
|
208
226
|
}
|
|
209
227
|
|
|
210
228
|
/**
|
|
@@ -386,6 +404,17 @@ declare function secs(num: number): number;
|
|
|
386
404
|
* @param ignoreNaN If true, NaN values will not throw an error.
|
|
387
405
|
*/
|
|
388
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;
|
|
389
418
|
|
|
390
419
|
declare const math_clamp: typeof clamp;
|
|
391
420
|
declare const math_invLerp: typeof invLerp;
|
|
@@ -395,8 +424,9 @@ declare const math_percent: typeof percent;
|
|
|
395
424
|
declare const math_remap: typeof remap;
|
|
396
425
|
declare const math_secs: typeof secs;
|
|
397
426
|
declare const math_sum: typeof sum;
|
|
427
|
+
declare const math_wrap: typeof wrap;
|
|
398
428
|
declare namespace math {
|
|
399
|
-
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 };
|
|
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 };
|
|
400
430
|
}
|
|
401
431
|
|
|
402
432
|
/**
|
|
@@ -799,4 +829,4 @@ declare const $: {
|
|
|
799
829
|
Loop: typeof Loop;
|
|
800
830
|
};
|
|
801
831
|
|
|
802
|
-
export { $, type AlphaCasing, type AnyFunc, Cache, type DateOptions, type DebouncedFunction, type DeepPartial, Loop, type MemoizedFunction, type ParseOptions, Pipe, type ReadDirOptions, 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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -97,23 +97,35 @@ declare namespace arr {
|
|
|
97
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
98
|
}
|
|
99
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
|
+
}
|
|
100
110
|
/**
|
|
101
|
-
* Retries an async function
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @param
|
|
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.
|
|
105
116
|
*/
|
|
106
|
-
declare function retry<T>(fn: () => Promise<T>,
|
|
117
|
+
declare function retry<T>(fn: (signal?: AbortSignal) => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
107
118
|
/**
|
|
108
119
|
* Returns a promise that resolves after the given number of milliseconds.
|
|
109
120
|
* @param ms The time to wait in milliseconds.
|
|
110
121
|
*/
|
|
111
122
|
declare function wait(ms: number): Promise<boolean>;
|
|
112
123
|
|
|
124
|
+
type async_RetryOptions = RetryOptions;
|
|
113
125
|
declare const async_retry: typeof retry;
|
|
114
126
|
declare const async_wait: typeof wait;
|
|
115
127
|
declare namespace async {
|
|
116
|
-
export { async_retry as retry, async_wait as wait };
|
|
128
|
+
export { type async_RetryOptions as RetryOptions, async_retry as retry, async_wait as wait };
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
interface MemoizedFunction<T extends (...args: any[]) => any> {
|
|
@@ -193,6 +205,11 @@ declare function duration(target: number | Date, style?: "digital" | "hms" | "ym
|
|
|
193
205
|
* @param locale - The BCP 47 language tag.
|
|
194
206
|
*/
|
|
195
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;
|
|
196
213
|
/**
|
|
197
214
|
* Parses shorthand strings (1h 30m) into milliseconds or seconds.
|
|
198
215
|
*/
|
|
@@ -202,9 +219,10 @@ type date_DateOptions = DateOptions;
|
|
|
202
219
|
type date_ParseOptions = ParseOptions;
|
|
203
220
|
declare const date_duration: typeof duration;
|
|
204
221
|
declare const date_eta: typeof eta;
|
|
222
|
+
declare const date_getAge: typeof getAge;
|
|
205
223
|
declare const date_parse: typeof parse;
|
|
206
224
|
declare namespace date {
|
|
207
|
-
export { type date_DateOptions as DateOptions, type date_ParseOptions as ParseOptions, date_duration as duration, date_eta as eta, date_parse as parse };
|
|
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 };
|
|
208
226
|
}
|
|
209
227
|
|
|
210
228
|
/**
|
|
@@ -386,6 +404,17 @@ declare function secs(num: number): number;
|
|
|
386
404
|
* @param ignoreNaN If true, NaN values will not throw an error.
|
|
387
405
|
*/
|
|
388
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;
|
|
389
418
|
|
|
390
419
|
declare const math_clamp: typeof clamp;
|
|
391
420
|
declare const math_invLerp: typeof invLerp;
|
|
@@ -395,8 +424,9 @@ declare const math_percent: typeof percent;
|
|
|
395
424
|
declare const math_remap: typeof remap;
|
|
396
425
|
declare const math_secs: typeof secs;
|
|
397
426
|
declare const math_sum: typeof sum;
|
|
427
|
+
declare const math_wrap: typeof wrap;
|
|
398
428
|
declare namespace math {
|
|
399
|
-
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 };
|
|
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 };
|
|
400
430
|
}
|
|
401
431
|
|
|
402
432
|
/**
|
|
@@ -799,4 +829,4 @@ declare const $: {
|
|
|
799
829
|
Loop: typeof Loop;
|
|
800
830
|
};
|
|
801
831
|
|
|
802
|
-
export { $, type AlphaCasing, type AnyFunc, Cache, type DateOptions, type DebouncedFunction, type DeepPartial, Loop, type MemoizedFunction, type ParseOptions, Pipe, type ReadDirOptions, 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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -294,13 +294,41 @@ __export(async_exports, {
|
|
|
294
294
|
retry: () => retry,
|
|
295
295
|
wait: () => wait
|
|
296
296
|
});
|
|
297
|
-
async function retry(fn,
|
|
297
|
+
async function retry(fn, options = {}) {
|
|
298
|
+
const { retries = 3, delay = 500, timeout, signal } = options;
|
|
299
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
300
|
+
const executeWithTimeout = async () => {
|
|
301
|
+
if (!timeout) return fn(signal);
|
|
302
|
+
const controller = new AbortController();
|
|
303
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
304
|
+
try {
|
|
305
|
+
return await fn(controller.signal);
|
|
306
|
+
} catch (err) {
|
|
307
|
+
if (controller.signal.aborted) throw new Error(`Attempt timed out after ${timeout}ms`);
|
|
308
|
+
throw err;
|
|
309
|
+
} finally {
|
|
310
|
+
clearTimeout(timer);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
298
313
|
try {
|
|
299
|
-
return await
|
|
314
|
+
return await executeWithTimeout();
|
|
300
315
|
} catch (error) {
|
|
316
|
+
if (signal?.aborted) throw error;
|
|
301
317
|
if (retries <= 0) throw error;
|
|
302
318
|
const jitter = Math.random() * 200;
|
|
303
|
-
|
|
319
|
+
const totalDelay = delay + jitter;
|
|
320
|
+
await new Promise((resolve, reject) => {
|
|
321
|
+
const timer = setTimeout(resolve, totalDelay);
|
|
322
|
+
signal?.addEventListener(
|
|
323
|
+
"abort",
|
|
324
|
+
() => {
|
|
325
|
+
clearTimeout(timer);
|
|
326
|
+
reject(new Error("Operation aborted"));
|
|
327
|
+
},
|
|
328
|
+
{ once: true }
|
|
329
|
+
);
|
|
330
|
+
});
|
|
331
|
+
return retry(fn, { ...options, retries: retries - 1, delay: delay * 2 });
|
|
304
332
|
}
|
|
305
333
|
}
|
|
306
334
|
function wait(ms2) {
|
|
@@ -342,6 +370,7 @@ var date_exports = {};
|
|
|
342
370
|
__export(date_exports, {
|
|
343
371
|
duration: () => duration,
|
|
344
372
|
eta: () => eta,
|
|
373
|
+
getAge: () => getAge,
|
|
345
374
|
parse: () => parse
|
|
346
375
|
});
|
|
347
376
|
var MS_MAP = {
|
|
@@ -400,6 +429,15 @@ function eta(date, locale) {
|
|
|
400
429
|
}
|
|
401
430
|
return "";
|
|
402
431
|
}
|
|
432
|
+
function getAge(birthdate) {
|
|
433
|
+
const today2 = /* @__PURE__ */ new Date();
|
|
434
|
+
let age = today2.getFullYear() - birthdate.getFullYear();
|
|
435
|
+
const monthDiff = today2.getMonth() - birthdate.getMonth();
|
|
436
|
+
if (monthDiff < 0 || monthDiff === 0 && today2.getDate() < birthdate.getDate()) {
|
|
437
|
+
age--;
|
|
438
|
+
}
|
|
439
|
+
return age;
|
|
440
|
+
}
|
|
403
441
|
function parse(str2, options = {}) {
|
|
404
442
|
if (typeof str2 === "number") return str2;
|
|
405
443
|
const matches = str2.matchAll(/(-?\d+)([a-z]+)/gi);
|
|
@@ -554,7 +592,8 @@ __export(math_exports, {
|
|
|
554
592
|
percent: () => percent,
|
|
555
593
|
remap: () => remap,
|
|
556
594
|
secs: () => secs,
|
|
557
|
-
sum: () => sum
|
|
595
|
+
sum: () => sum,
|
|
596
|
+
wrap: () => wrap
|
|
558
597
|
});
|
|
559
598
|
function clamp(num, a, b) {
|
|
560
599
|
let min = b !== void 0 ? a : 0;
|
|
@@ -592,6 +631,9 @@ function sum(array, selector) {
|
|
|
592
631
|
return (isNaN(b) ? 0 : b) < 0 ? a - -b : a + (b || 0);
|
|
593
632
|
}, 0);
|
|
594
633
|
}
|
|
634
|
+
function wrap(num, max) {
|
|
635
|
+
return (num % max + max) % max;
|
|
636
|
+
}
|
|
595
637
|
|
|
596
638
|
// src/obj.ts
|
|
597
639
|
var obj_exports = {};
|
|
@@ -1072,6 +1114,7 @@ export {
|
|
|
1072
1114
|
float,
|
|
1073
1115
|
forceArray,
|
|
1074
1116
|
get,
|
|
1117
|
+
getAge,
|
|
1075
1118
|
getFlag,
|
|
1076
1119
|
has,
|
|
1077
1120
|
hasFlag,
|
|
@@ -1112,6 +1155,6 @@ export {
|
|
|
1112
1155
|
today,
|
|
1113
1156
|
unique,
|
|
1114
1157
|
wait,
|
|
1115
|
-
weighted
|
|
1158
|
+
weighted,
|
|
1159
|
+
wrap
|
|
1116
1160
|
};
|
|
1117
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qznt",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "A lightweight typed utility toolkit for modern TypeScript environments.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "xsqu1znt",
|
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
|
-
"require": "./dist/index.cjs"
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"./package.json": "./package.json"
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
18
16
|
},
|
|
17
|
+
"type": "module",
|
|
19
18
|
"files": [
|
|
20
19
|
"dist",
|
|
21
20
|
"README.md"
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/arr.ts","../src/rnd.ts","../src/async.ts","../src/fn.ts","../src/date.ts","../src/format.ts","../src/fs.ts","../src/is.ts","../src/math.ts","../src/obj.ts","../src/str.ts","../src/timing.ts","../src/to.ts","../src/Pipe.ts","../src/Storage.ts","../src/Cache.ts","../src/Loop.ts"],"sourcesContent":["import * as arr from \"./arr\";\nimport * as async from \"./async\";\nimport * as fn from \"./fn\";\nimport * as date from \"./date\";\nimport * as format from \"./format\";\nimport * as fs from \"./fs\";\nimport * as is from \"./is\";\nimport * as math from \"./math\";\nimport * as obj from \"./obj\";\nimport * as rnd from \"./rnd\";\nimport * as str from \"./str\";\nimport * as timing from \"./timing\";\nimport * as to from \"./to\";\nimport { Pipe } from \"./Pipe\";\nimport { Storage } from \"./Storage\";\nimport { Cache } from \"./Cache\";\nimport { Loop } from \"./Loop\";\n\nconst qznt = {\n arr,\n async,\n fn,\n date,\n format,\n fs,\n is,\n math,\n obj,\n timing,\n rnd,\n str,\n to,\n Pipe,\n Storage,\n Cache,\n Loop\n};\n\nexport const $ = qznt;\nexport default qznt;\n\nexport * from \"./arr\";\nexport * from \"./async\";\nexport * from \"./fn\";\nexport * from \"./date\";\nexport * from \"./format\";\nexport * from \"./fs\";\nexport * from \"./is\";\nexport * from \"./math\";\nexport * from \"./obj\";\nexport * from \"./rnd\";\nexport * from \"./str\";\nexport * from \"./timing\";\nexport * from \"./to\";\nexport * from \"./types\";\nexport { Pipe } from \"./Pipe\";\nexport { Storage } from \"./Storage\";\nexport { Cache } from \"./Cache\";\nexport { Loop } from \"./Loop\";\n","import * as rnd from \"./rnd\";\n\nexport type SequentialMapContext<T, U> = {\n index: number;\n lastElement: U | undefined;\n newArray: ReadonlyArray<U>;\n originalArray: ReadonlyArray<T>;\n};\n\n/**\n * Splits an array into sub-arrays (chunks) of a maximum size.\n * @param array Array to process.\n * @param size The maximum size of each chunk.\n */\nfunction chunk<T>(array: ReadonlyArray<T>, size: number): T[][] {\n if (size <= 0) throw new Error(\"chunk: Size must be a positive integer.\");\n\n const result: T[][] = [];\n const len = array.length;\n\n for (let i = 0; i < len; i += size) {\n result.push(array.slice(i, i + size));\n }\n\n return result;\n}\n\n/**\n * Groups adjacent elements of an array together based on a predicate.\n * @param array Array to process.\n * @param predicate A function that returns true if two adjacent elements belong in the same chunk.\n * @example\n * // Group consecutive identical numbers\n * chunkBy([1, 1, 2, 3, 3, 3], (a, b) => a === b);\n * // [[1, 1], [2], [3, 3, 3]]\n */\nfunction chunkAdj<T>(array: ReadonlyArray<T>, predicate: (prev: T, curr: T) => boolean): T[][] {\n if (array.length === 0) return [];\n\n const results: T[][] = [];\n const len = array.length;\n let currentChunk: T[] = [array[0]!];\n\n for (let i = 1; i < len; i++) {\n const prev = array[i - 1]!;\n const curr = array[i]!;\n\n if (predicate(prev, curr)) {\n currentChunk.push(curr);\n } else {\n results.push(currentChunk);\n currentChunk = [curr];\n }\n }\n\n results.push(currentChunk);\n return results;\n}\n\n/**\n * Groups elements by a key.\n * @param array Array to process.\n * @param iteratee Function to determine the key to group by.\n * @param maxChunkSize Optionally chunk groups and flatten them (useful for pagination).\n */\nfunction cluster<T>(array: ReadonlyArray<T>, iteratee: (item: T) => string | number, maxChunkSize?: number): T[][] {\n const groups = new Map<string | number, T[]>();\n\n for (const item of array) {\n const key = iteratee(item);\n const collection = groups.get(key);\n if (!collection) {\n groups.set(key, [item]);\n } else {\n collection.push(item);\n }\n }\n\n const result: T[][] = [];\n\n for (const group of groups.values()) {\n if (maxChunkSize && maxChunkSize > 0) {\n // If chunking is enabled, split this specific group\n for (let i = 0; i < group.length; i += maxChunkSize) {\n result.push(group.slice(i, i + maxChunkSize));\n }\n } else {\n // Otherwise, just push the whole group as one chunk\n result.push(group);\n }\n }\n\n return result;\n}\n\n/**\n * Removes unwanted values from an array.\n * @param array Array to process.\n * @param mode 'nullable' (default) removes null/undefined. 'falsy' removes null, undefined, 0, \"\", false, and NaN.\n */\nfunction compact<T>(array: ReadonlyArray<T>, mode?: \"nullable\"): NonNullable<T>[];\nfunction compact<T>(array: ReadonlyArray<T>, mode: \"falsy\"): Exclude<T, null | undefined | false | 0 | \"\">[];\nfunction compact<T>(array: ReadonlyArray<T>, mode: \"nullable\" | \"falsy\" = \"nullable\"): any[] {\n if (mode === \"falsy\") {\n // Boolean constructor handles all falsy values\n return array.filter(Boolean);\n }\n\n // Only removes null and undefined\n return array.filter(item => item !== null && item !== undefined);\n}\n\n/**\n * Forces a given item to be an array.\n * @param item The item to force into an array.\n */\nfunction forceArray<T>(item: T): T[] {\n return Array.isArray(item) ? item : [item];\n}\n\n/**\n * Searches a sorted array for a value using the binary search method.\n * Returns the index if found, or the bitwise complement (~index) of the\n * position where the value should be inserted to keep it sorted.\n * @param array The array to process.\n * @param target The value to search for.\n * @param comparator Optional comparator function.\n */\nfunction search<T>(\n array: T[],\n target: T,\n comparator: (a: T, b: T) => number = (a, b) => (a > b ? 1 : a < b ? -1 : 0)\n): number {\n let low = 0;\n let high = array.length - 1;\n\n while (low <= high) {\n const mid = (low + high) >>> 1;\n const comp = comparator(array[mid]!, target);\n\n if (comp < 0) low = mid + 1;\n else if (comp > 0) high = mid - 1;\n else return mid;\n }\n\n return ~low;\n}\n\n/**\n * Maps over an array with access to the previously mapped elements.\n * @param array Array to process.\n * @param callback Function to map over the array.\n */\nfunction seqMap<T, U>(array: ReadonlyArray<T>, callback: (item: T, context: SequentialMapContext<T, U>) => U): U[] {\n const len = array.length;\n const result: U[] = new Array(len);\n\n for (let i = 0; i < len; i++) {\n result[i] = callback(array[i]!, {\n index: i,\n lastElement: i > 0 ? result[i - 1] : undefined,\n // NOTE: This is a reference to the array currently being built\n newArray: result,\n originalArray: array\n });\n }\n\n return result;\n}\n\n/**\n * Shuffles an array using the Fisher-Yates algorithm.\n * @param array The array to shuffle.\n * @param seed Optional seed for RNG.\n */\nfunction shuffle<T>(array: ReadonlyArray<T>, seed?: number): T[] {\n const random = seed !== undefined ? rnd.prng(seed) : Math.random;\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n const temp = result[i]!;\n result[i] = result[j]!;\n result[j] = temp;\n }\n\n return result;\n}\n\n/**\n * Sorts an array by a single property in order.\n * @param order 'asc' for ascending (default) or 'desc' for descending.\n * @param array Array to process.\n * @param selector Function to determine the key to sort by.\n */\nfunction sortBy<T>(array: ReadonlyArray<T>, selector: (item: T) => any, order?: \"asc\" | \"desc\"): T[];\n/**\n * Sorts an array by one or more properties in order.\n * @param order 'asc' for ascending (default) or 'desc' for descending.\n * @param array Array to process.\n * @param selectors Functions to determine the keys to sort by.\n */\nfunction sortBy<T>(array: ReadonlyArray<T>, selectors: (item: T) => any[], order?: \"asc\" | \"desc\"): T[];\nfunction sortBy<T>(\n array: ReadonlyArray<T>,\n selectorOrSelectors: (item: T) => any | ((item: T) => any)[],\n order: \"asc\" | \"desc\" = \"asc\"\n): T[] {\n const selectors = Array.isArray(selectorOrSelectors) ? selectorOrSelectors : [selectorOrSelectors];\n\n if (array.length === 0 || selectors.length === 0) {\n return [...array];\n }\n\n const modifier = order === \"desc\" ? -1 : 1;\n const memos = array.map(item => ({ item, keys: selectors.map(s => s(item)) }));\n\n memos.sort((a, b) => {\n for (let i = 0; i < selectors.length; i++) {\n const valA = a.keys[i];\n const valB = b.keys[i];\n\n if (valA === valB) continue;\n\n // Nullish values are pushed to the end regardless of order\n if (valA == null) return 1;\n if (valB == null) return -1;\n\n if (valA < valB) return -1 * modifier;\n if (valA > valB) return 1 * modifier;\n }\n return 0;\n });\n\n return memos.map(m => m.item);\n}\n\n/**\n * Returns an array of unique elements from the given array.\n * Uniqueness is determined by the given key function.\n * @param array Array to process.\n * @param key Function to determine the keys to filter by\n */\nfunction unique<T>(array: T[], key: (item: T) => any): T[] {\n return Array.from(new Map(array.map(item => [key(item), item])).values());\n}\n\nexport { chunk, chunkAdj, cluster, compact, forceArray, search, seqMap, shuffle, sortBy, unique };\n","export type AlphaCasing = \"lower\" | \"upper\" | \"mixed\";\n\nexport interface RndArrayOptions<T> {\n /** Optional seed for RNG. */\n seed?: number;\n /** Reroll if the result is equal to this value. */\n not?: ((item: T) => boolean) | (T | null | undefined);\n /** Maximum number of times to reroll if `not` is specified. [default: 10] */\n maxRerolls?: number;\n}\n\nexport interface RndStrOptions {\n /** Optional seed for RNG. */\n seed?: number;\n /** Character casing mode. */\n casing?: AlphaCasing;\n /** Custom character pool. */\n customChars?: string;\n /** Characters to exclude from the pool. */\n exclude?: string | string[];\n}\n\nconst LOWER = \"abcdefghijklmnopqrstuvwxyz\";\nconst UPPER = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nconst NUM = \"0123456789\";\n\n/**\n * Returns true based on a percentage probability.\n * @param percent A value between 0 and 1. [default: 0.5]\n * @param seed Optional seed for RNG.\n */\nfunction chance(percent: number = 0.5, seed?: number): boolean {\n if (percent <= 0) return false;\n if (percent >= 1) return true;\n const random = seed !== undefined ? prng(seed) : Math.random;\n return random() < percent;\n}\n\n/**\n * Returns a random item from the given array.\n * @param array Array of items to choose from.\n * @param options Options for the choice function.\n */\nfunction choice<T>(array: T[], options: RndArrayOptions<T> = {}): T {\n const { seed, not, maxRerolls = 10 } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n const rnd = () => array[Math.floor(random() * array.length)]!;\n\n let result: T = rnd();\n\n // NOTE: Ignores rerolling if seed is set and result is equal to `not`\n // to prevent infinite loops\n if (seed === undefined && array.length > 1 && not !== undefined) {\n let rerolls = 0;\n\n const shouldReroll = () => (typeof not === \"function\" ? (not as (item: T) => boolean)(result) : result === not);\n while (shouldReroll() && rerolls < maxRerolls) {\n result = rnd();\n rerolls++;\n }\n }\n\n return result;\n}\n\n/**\n * Returns a random item from the given array based on their corresponding weights.\n * @param array Array of items to choose from.\n * @param selector Function that selects the item's weight.\n * @param seed Optional seed for RNG.\n */\nfunction weighted<T>(array: T[], selector: (item: T) => number, seed?: number): T {\n const random = seed !== undefined ? prng(seed) : Math.random;\n\n const cumulativeWeights: number[] = [];\n let currentSum = 0;\n\n // Calculate cumulative weights\n for (const item of array) {\n const weight = selector(item);\n currentSum += weight;\n cumulativeWeights.push(currentSum);\n }\n\n const decider = random() * currentSum;\n\n let index: number;\n\n // Linear search | O(n)\n if (array.length < 20) {\n index = cumulativeWeights.findIndex(w => w >= decider);\n }\n // Binary Search | O(log n)\n else {\n let low = 0;\n let high = cumulativeWeights.length - 1;\n\n while (low < high) {\n const mid = (low + high) >>> 1;\n if (decider > cumulativeWeights[mid]!) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n index = low;\n }\n\n return array[index]!;\n}\n\n/**\n * Returns an object with a single method, `pick`, which returns a random item from the given array in O(1) time.\n * The probability of each item being picked is determined by the corresponding weight in the `weights` array.\n * @param items Array of items to choose from.\n * @param selector Function that selects the item's weight.\n * @param seed Optional seed for RNG.\n */\nfunction sampler<T>(items: T[], selector: (item: T) => number, seed?: number) {\n const callRandom = seed ? prng(seed) : undefined;\n const len = items.length;\n\n const prob = new Array(len);\n const alias = new Array(len);\n\n const weights = items.map(selector);\n const totalWeight = weights.reduce((a, b) => a + b, 0);\n const scaledWeights = weights.map(w => (w * len) / totalWeight);\n\n const small: number[] = [];\n const large: number[] = [];\n\n scaledWeights.forEach((w, i) => (w < 1 ? small : large).push(i));\n\n while (small.length && large.length) {\n const s = small.pop()!;\n const l = large.pop()!;\n prob[s] = scaledWeights[s];\n alias[s] = l;\n scaledWeights[l] = scaledWeights[l]! + scaledWeights[s]! - 1;\n (scaledWeights[l] < 1 ? small : large).push(l);\n }\n\n while (large.length) prob[large.pop()!] = 1;\n while (small.length) prob[small.pop()!] = 1;\n\n return {\n /**\n * Returns a random item from the given array in O(1) time.\n * @param seed Optional seed for RNG.\n */\n pick: (seed?: number) => {\n const random = seed !== undefined ? prng(seed) : callRandom || Math.random;\n const i = Math.floor(random() * len);\n return random() < prob[i] ? items[i] : items[alias[i]];\n }\n };\n}\n\n/**\n * Creates a deterministic pseudo-random number generator (PRNG) using the Mulberry32 algorithm.\n * @param seed An integer seed value.\n * @example\n * const rng = prng(123);\n * const val1 = rng(); // Always the same for seed 123\n */\nfunction prng(seed: number): () => number {\n return () => {\n let t = (seed += 0x6d2b79f5);\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/**\n * Generates a random float between the given minimum and maximum values.\n * @param min The minimum value (inclusive) for the random float.\n * @param max The maximum value (inclusive) for the random float.\n * @param seed Optional seed for RNG.\n */\nfunction float(min: number, max: number, seed?: number): number {\n const random = seed !== undefined ? prng(seed) : Math.random;\n return random() * (max - min) + min;\n}\n\n/**\n * Returns a random index from the given array.\n * @param array The array to generate an index for.\n * @param options Options for the index function.\n */\nfunction index<T>(array: T[], options: RndArrayOptions<number> = {}): number {\n const { seed, not, maxRerolls = 10 } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n const rnd = () => Math.floor(random() * array.length);\n\n let result: number = rnd();\n\n // NOTE: Ignores rerolling if seed is set and result is equal to `not`\n // to prevent infinite loops\n if (seed === undefined && array.length > 1 && not !== undefined) {\n let rerolls = 0;\n\n const shouldReroll = () => (typeof not === \"function\" ? (not as (item: number) => boolean)(result) : result === not);\n while (shouldReroll() && rerolls < maxRerolls) {\n result = rnd();\n rerolls++;\n }\n }\n\n return result;\n}\n\n/**\n * Generates a random integer between the given minimum and maximum values.\n * @param min The minimum value (inclusive) for the random integer.\n * @param max The maximum value (inclusive) for the random integer.\n * @param seed Optional seed for RNG.\n */\nfunction int(min: number, max: number, seed?: number): number {\n const random = seed !== undefined ? prng(seed) : Math.random;\n return Math.floor(random() * (max - min + 1)) + min;\n}\n\n/**\n * Generates a random string of the given length using the specified character pool.\n * @param len The length of the random string.\n * @param mode The character pool to use. Can be \"number\", \"alpha\", \"alphanumeric\", or \"custom\".\n * @param options Options for the rndStr function.\n */\nfunction str(len: number, mode: \"number\" | \"alpha\" | \"alphanumeric\" | \"custom\", options: RndStrOptions = {}) {\n const { casing = \"lower\", seed, customChars = \"\", exclude = \"\" } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n\n const alphaPool = { lower: LOWER, upper: UPPER, mixed: LOWER + UPPER }[casing];\n let pool = { number: NUM, alpha: alphaPool, alphanumeric: alphaPool + NUM, custom: customChars }[mode];\n\n if (exclude.length > 0) {\n const excludeSet = new Set(Array.isArray(exclude) ? exclude : exclude.split(\"\"));\n pool = pool\n .split(\"\")\n .filter(char => !excludeSet.has(char))\n .join(\"\");\n }\n\n // Safety check\n if (pool.length === 0) throw new Error(\"rndStr: Character pool is empty after exclusions.\");\n\n const result = new Array(len);\n const poolLen = pool.length;\n\n for (let i = 0; i < len; i++) {\n result[i] = pool[Math.floor(random() * poolLen)];\n }\n\n return result.join(\"\");\n}\n\nexport { chance, choice, weighted, sampler, prng, float, index, int, str };\n","/**\n * Retries an async function with exponential backoff.\n * @param fn The async function to attempt.\n * @param retries Maximum number of retry attempts. [default: 3]\n * @param delay Initial delay in milliseconds. [default: 500ms]\n */\nasync function retry<T>(fn: () => Promise<T>, retries: number = 3, delay: number = 500): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n if (retries <= 0) throw error;\n const jitter = Math.random() * 200;\n return await new Promise(resolve => setTimeout(resolve, delay + jitter));\n }\n}\n\n/**\n * Returns a promise that resolves after the given number of milliseconds.\n * @param ms The time to wait in milliseconds.\n */\nfunction wait(ms: number): Promise<boolean> {\n return new Promise(resolve =>\n setTimeout(() => {\n resolve(true);\n }, ms)\n );\n}\n\nexport { retry, wait };\n","export interface MemoizedFunction<T extends (...args: any[]) => any> {\n (...args: Parameters<T>): ReturnType<T>;\n /** Clears the cache. */\n clear: () => void;\n}\n\n/**\n * Memoizes a function by caching its results based on the input arguments.\n * A resolver function can be provided to customize the key generation.\n * If no resolver is provided, the key will be generated by JSON stringify-ing the input arguments.\n * @param fn The function to memoize.\n * @param resolver An optional resolver function to customize the key generation.\n * @example\n * // 1. Basic usage\n * const heavyCalc = memoize((n: number) => {\n * console.log('Calculating...');\n * return n * 2;\n * });\n * heavyCalc(5); // Logs 'Calculating...' and returns 10\n * heavyCalc(5); // Returns 10 immediately from cache\n * @example\n * // 2. Using maxAge (TTL)\n * const getStockPrice = memoize(fetchPrice, { maxAge: 60000 }); // 1 minute cache\n * @example\n * // 3. Using a custom resolver\n * const getUser = memoize(\n * (user, theme) => render(user, theme),\n * { resolver: (user) => user.id } // Only cache based on ID, ignore theme\n * );\n * @example\n * // 4. Manual cache clearing\n * heavyCalc.clear();\n */\nfunction memoize<T extends (...args: any[]) => any>(\n fn: T,\n options: {\n /** Function to generate a cache key from the input arguments. */\n resolver?: (...args: Parameters<T>) => string;\n /** The time to wait in milliseconds before expiring a cache entry. */\n maxAge?: number;\n } = {}\n): MemoizedFunction<T> {\n const cache = new Map<string, { value: any; timestamp: number }>();\n const { resolver, maxAge } = options;\n\n const memoized = function (this: any, ...args: Parameters<T>) {\n const key = resolver ? resolver(...args) : JSON.stringify(args);\n const now = Date.now();\n const entry = cache.get(key);\n\n // Check if we have a valid (unexpired) entry\n if (entry) {\n if (!maxAge || now - entry.timestamp < maxAge) {\n return entry.value;\n }\n // Delete it since it's expired\n cache.delete(key);\n }\n\n const result = fn.apply(this, args);\n cache.set(key, { value: result, timestamp: now });\n return result;\n } as MemoizedFunction<T>;\n\n memoized.clear = () => cache.clear();\n\n return memoized;\n}\n\nexport { memoize };\n","export interface DateOptions {\n /** The reference timestamp to calculate from. Defaults to Date.now() */\n since?: number | Date;\n /** If true, returns null if the target time is in the past. */\n nullIfPast?: boolean;\n /** If true, omits the \" ago\" suffix for past dates. */\n ignorePast?: boolean;\n}\n\nexport interface ParseOptions {\n /** Return value in seconds instead of milliseconds. */\n unit?: \"ms\" | \"s\";\n /** If true, returns the absolute Unix timestamp (Date.now() + result). */\n fromNow?: boolean;\n}\n\nconst MS_MAP: Record<string, number> = {\n ms: 1,\n s: 1000,\n m: 60000,\n h: 3600000,\n d: 86400000,\n w: 604800000,\n mth: 2419200000,\n y: 31536000000\n};\n\n/**\n * Duration formatter.\n *\n * Available styles:\n * - Digital (00:00)\n * - HMS\n * - YMDHMS.\n * @param target The target time to calculate from.\n * @param style The output style to use.\n * @param options Formatting options.\n */\nfunction duration(\n target: number | Date,\n style: \"digital\" | \"hms\" | \"ymdhms\" = \"hms\",\n options: DateOptions = {}\n): string | null {\n const targetMs = target instanceof Date ? target.getTime() : Number(target);\n const sinceMs = options.since instanceof Date ? options.since.getTime() : Number(options.since) || Date.now();\n const diff = Math.abs(targetMs - sinceMs);\n\n if (diff === 0) return style === \"digital\" ? \"00:00\" : \"now\";\n\n const s = Math.floor(diff / 1000) % 60;\n const m = Math.floor(diff / 60000) % 60;\n const h = Math.floor(diff / 3600000) % 24;\n const d = Math.floor(diff / 86400000);\n\n if (style === \"digital\") {\n const parts = [m, s].map(v => String(v).padStart(2, \"0\"));\n if (h > 0 || d > 0) parts.unshift(String(h).padStart(2, \"0\"));\n if (d > 0) parts.unshift(String(d)); // Days don't necessarily need padding\n return parts.join(\":\");\n }\n\n const result: string[] = [];\n const push = (val: number, label: string) => {\n if (val > 0) result.push(`${val} ${label}${val === 1 ? \"\" : \"s\"}`);\n };\n\n if (style === \"ymdhms\") push(d, \"day\");\n push(h, \"hour\");\n push(m, \"minute\");\n push(s, \"second\");\n\n if (result.length === 0) return \"0 seconds\";\n if (result.length === 1) return result[0]!;\n\n const last = result.pop();\n return `${result.join(\", \")} and ${last}`;\n}\n\n/**\n * Formats a date or timestamp into a human-readable relative string (e.g., \"3 days ago\").\n * @param date - The Date object or timestamp to compare.\n * @param locale - The BCP 47 language tag.\n */\nfunction eta(date: Date | number, locale?: Intl.LocalesArgument): string {\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n const elapsed = (typeof date === \"number\" ? date : date.getTime()) - Date.now();\n\n // Division factors for different units\n const units: { unit: Intl.RelativeTimeFormatUnit; ms: number }[] = [\n { unit: \"year\", ms: 31536000000 },\n { unit: \"month\", ms: 2628000000 },\n { unit: \"day\", ms: 86400000 },\n { unit: \"hour\", ms: 3600000 },\n { unit: \"minute\", ms: 60000 },\n { unit: \"second\", ms: 1000 }\n ];\n\n // Find the largest unit that fits the elapsed time\n for (const { unit, ms } of units) {\n if (Math.abs(elapsed) >= ms || unit === \"second\") {\n return rtf.format(Math.round(elapsed / ms), unit);\n }\n }\n\n return \"\";\n}\n\n/**\n * Parses shorthand strings (1h 30m) into milliseconds or seconds.\n */\nfunction parse(str: string | number, options: ParseOptions = {}): number {\n if (typeof str === \"number\") return str;\n\n const matches = str.matchAll(/(-?\\d+)([a-z]+)/gi);\n let totalMs = 0;\n let found = false;\n\n for (const [_, value, unit] of matches) {\n if (!value || !unit) continue;\n const factor = MS_MAP[unit.toLowerCase()];\n if (factor) {\n totalMs += parseInt(value) * factor;\n found = true;\n }\n }\n\n if (!found) throw new Error(`parse: Invalid time format: \"${str}\"`);\n\n const result = options.unit === \"s\" ? totalMs / 1000 : totalMs;\n return options.fromNow ? Date.now() + result : result;\n}\n\nexport { duration, eta, parse };\n","/**\n * Formats a number as a currency string using international standards.\n * @param num - The number to process.\n * @param options - Formatting options.\n * @example\n * currency(1234.5); // \"$1,234.50\"\n * currency(1234.5, 'EUR', 'de-DE'); // \"1.234,50 €\"\n * currency(500, 'JPY'); // \"¥500\" (Yen has no decimals)\n */\nfunction currency(\n num: number,\n options: {\n /** The ISO currency code (e.g., 'USD', 'EUR', 'GBP'). */\n currency?: string;\n /** The BCP 47 language tag. */\n locale?: Intl.LocalesArgument;\n } = {}\n): string {\n return new Intl.NumberFormat(options.locale, {\n style: \"currency\",\n currency: options.currency\n }).format(num);\n}\n\n/**\n * Formats a number with thousands separators and optional decimal precision.\n * @param num - The number to process.\n * @param options - Formatting options.\n * @example\n * num(1000000); // \"1,000,000\" (en-US default)\n * num(1000, { locale: 'de-DE' }); // \"1.000\"\n * num(1234.567, { precision: 2 }); // \"1,234.57\"\n */\nfunction number(\n num: number,\n options: {\n /** The BCP 47 language tag. */\n locale?: Intl.LocalesArgument;\n precision?: number;\n } = {}\n): string {\n return new Intl.NumberFormat(options.locale, {\n minimumFractionDigits: options.precision,\n maximumFractionDigits: options.precision\n }).format(num);\n}\n\nfunction memory(\n bytes: number,\n decimals: number = 1,\n units: string[] = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n): string {\n // Handle 0 or negative numbers immediately\n if (bytes <= 0) return `0 ${units[0]}`;\n\n // Calculate the magnitude index (0 for B, 1 for KB, etc.)\n const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n const val = bytes / Math.pow(1024, i);\n return `${val.toFixed(i === 0 ? 0 : decimals)} ${units[i]}`;\n}\n\n/**\n * Formats a number to an ordinal (e.g., 1st, 2nd, 3rd).\n * @param num The number to process.\n * @param locale The BCP 47 language tag.\n */\nfunction ordinal(num: number | string, locale?: Intl.LocalesArgument): string {\n const _num = Number(num);\n if (isNaN(_num)) throw new TypeError(\"Invalid input\");\n\n const pr = new Intl.PluralRules(locale, { type: \"ordinal\" });\n const rule = pr.select(_num);\n\n const suffixes: Record<string, string> = {\n one: \"st\",\n two: \"nd\",\n few: \"rd\",\n other: \"th\"\n };\n\n const suffix = suffixes[rule] || \"th\";\n return _num.toLocaleString(locale) + suffix;\n}\n\n/**\n * Formats a number into a compact, human-readable string (e.g., 1.2k, 1M).\n * @param num - The number to process.\n * @param locale - The BCP 47 language tag.\n */\nfunction compactNumber(num: number, locale?: Intl.LocalesArgument): string {\n return new Intl.NumberFormat(locale, {\n notation: \"compact\",\n compactDisplay: \"short\",\n maximumFractionDigits: 1\n }).format(num);\n}\n\nexport { currency, number, memory, ordinal, compactNumber };\n","import _fs from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface ReadDirOptions {\n /** Whether to scan subdirectories. [default: true] */\n recursive?: boolean;\n}\n\n/**\n * Recursively (or shallowly) scans a directory and returns an array of relative file paths.\n * @param path The path to the directory.\n * @param options Options for the readDir function.\n */\nfunction readDir(path: string, options: ReadDirOptions = {}): string[] {\n const { recursive = true } = options;\n\n if (!_fs.existsSync(path)) return [];\n\n // Shallow read\n if (!recursive) {\n return _fs.readdirSync(path).filter(fn => {\n return _fs.statSync(join(path, fn)).isFile();\n });\n }\n\n // Recursive walk\n const walk = (dir: string, base: string = \"\"): string[] => {\n const results: string[] = [];\n\n // Using withFileTypes is much faster as it returns Dirent objects\n const entries = _fs.readdirSync(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const relativePath = base ? join(base, entry.name) : entry.name;\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory()) {\n results.push(...walk(fullPath, relativePath));\n } else if (entry.isFile()) {\n results.push(relativePath);\n }\n }\n\n return results;\n };\n\n return walk(path);\n}\n\nexport { readDir };\n","/**\n * Checks if a value is defined (not null or undefined).\n */\nfunction defined<T>(val: T | undefined | null): val is T {\n return val !== undefined && val !== null;\n}\n\n/**\n * Checks if a value is an empty object, array, or string.\n */\nfunction empty(val: unknown): boolean {\n if (!defined(val)) return true;\n if (string(val) || Array.isArray(val)) return val.length === 0;\n if (object(val)) return Object.keys(val).length === 0;\n return false;\n}\n\n/**\n * Checks if a number is within a specified range.\n * @param num The number to check.\n * @param min The minimum or maximum value of the range.\n * @param max The maximum value of the range (optional).\n */\nfunction inRange(num: number, max: number): boolean;\nfunction inRange(num: number, min: number, max: number): boolean;\nfunction inRange(num: number, a: number, b?: number): boolean {\n // If b is undefined, we are clamping [0, a]\n // If b is defined, we are clamping [a, b]\n let min = b !== undefined ? a : 0;\n let max = b !== undefined ? b : a;\n\n // Handles a swapped min/max\n if (min > max) [min, max] = [max, min];\n return num >= min && num <= max;\n}\n\n/**\n * Checks if a value is a plain object (not an array, null, or function).\n */\nfunction object(val: unknown): val is Record<string, any> {\n return val !== null && typeof val === \"object\" && !Array.isArray(val);\n}\n\n/**\n * Checks if an array is sorted.\n */\nfunction sorted<T>(arr: T[], comparator?: (a: T, b: T) => number): boolean {\n for (let i = 0; i < arr.length - 1; i++) {\n const comp = comparator ? comparator(arr[i]!, arr[i + 1]!) : arr[i]! > arr[i + 1]! ? 1 : -1;\n if (comp > 0) return false;\n }\n return true;\n}\n\n/**\n * Checks if a value is a string.\n */\nfunction string(val: unknown): val is string {\n return typeof val === \"string\";\n}\n\n/**\n * Checks if a date is today.\n */\nfunction today(date: number | Date): boolean {\n const d = date instanceof Date ? date : new Date(date);\n const today = new Date();\n return d.getDate() === today.getDate() && d.getMonth() === today.getMonth() && d.getFullYear() === today.getFullYear();\n}\n\nexport { defined, empty, inRange, object, sorted, string, today };\n","/**\n * Clamps a number within a specified range.\n * @param num The number to check.\n * @param min The minimum or maximum value of the range.\n * @param max The maximum value of the range (optional).\n */\nfunction clamp(num: number, max: number): number;\nfunction clamp(num: number, min: number, max: number): number;\nfunction clamp(num: number, a: number, b?: number): number {\n // If b is undefined, we are clamping [0, a]\n // If b is defined, we are clamping [a, b]\n let min = b !== undefined ? a : 0;\n let max = b !== undefined ? b : a;\n\n // Handles a swapped min/max\n if (min > max) [min, max] = [max, min];\n return Math.max(min, Math.min(num, max));\n}\n\n/**\n * Calculates the interpolation factor (0-1) of a value between two points.\n * @param start - The starting value (0%).\n * @param end - The ending value (100%).\n * @param value - The value to interpolate.\n * @example\n * invLerp(0, 100, 50); // 0.5\n */\nfunction invLerp(start: number, end: number, value: number): number {\n if (start === end) return 0;\n return (value - start) / (end - start);\n}\n\n/**\n * Linearly interpolates between two values.\n * @param start - The starting value (0%).\n * @param end - The ending value (100%).\n * @param t - The interpolation factor (0 to 1).\n * @example\n * lerp(0, 100, 0.5); // 50\n * lerp(10, 20, 0.2); // 12\n */\nfunction lerp(start: number, end: number, t: number): number {\n return start + (end - start) * t;\n}\n\n/**\n * Converts seconds to milliseconds and rounds it to the nearest integer.\n * @param num The number of seconds to convert.\n */\nfunction ms(num: number): number {\n return Math.floor(num * 1000);\n}\n\n/**\n * Calculates the percentage value between two numbers.\n * @param a The numerator.\n * @param b The denominator.\n * @param round Whether to round the result to the nearest integer.\n * @example\n * percent(50, 100) --> 50 // 50%\n * percent(30, 40) --> 75 // 75%\n */\nfunction percent(a: number, b: number, round: boolean = true): number {\n const result = (a / b) * 100;\n return round ? Math.floor(result) : result;\n}\n\n/**\n * Maps a value from one range to another.\n * @param value - The value to map.\n * @param inMin - The minimum value of the input range.\n * @param inMax - The maximum value of the input range.\n * @param outMin - The minimum value of the output range.\n * @param outMax - The maximum value of the output range.\n * @example\n * // Convert mouse X position (0-1920) to a volume level (0-1)\n * const volume = remap(mouseX, 0, 1920, 0, 1);\n */\nfunction remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number {\n const t = invLerp(inMin, inMax, value);\n return lerp(outMin, outMax, t);\n}\n\n/**\n * Converts milliseconds to seconds and rounds it to the nearest integer.\n * @param num The number of milliseconds to convert.\n */\nfunction secs(num: number): number {\n return Math.floor(num / 1000);\n}\n\n/**\n * Returns the sum of an array of numbers. Negative values subtract from the total.\n * @param array The array to sum.\n * @param selector Function that selects the item's weight.\n * @param ignoreNaN If true, NaN values will not throw an error.\n */\nfunction sum<T>(array: T[], selector?: (item: T) => number): number {\n const _array = selector ? array.map(selector) : array;\n if (!_array.every(v => typeof v === \"number\")) {\n throw new TypeError(`sum: Array must only contain numbers.`);\n }\n\n return _array.reduce((a, b) => {\n return (isNaN(b) ? 0 : b) < 0 ? a - -b : a + (b || 0);\n }, 0);\n}\n\nexport { clamp, invLerp, lerp, ms, percent, remap, secs, sum };\n","/**\n * Retrieves a nested property.\n * @param obj The object to process.\n * @param path The path to retrieve (e.g., 'data.users[0].id').\n * @param defaultValue The default value to return if the property does not exist.\n */\nfunction get<T = any>(obj: Record<string, any>, path: string, defaultValue?: T): T {\n if (!obj) throw new Error(\"get: Target object is null or undefined\");\n\n // Normalize and split\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n const trace: string[] = [];\n\n for (const part of parts) {\n trace.push(part);\n\n // Check if the link in the chain exists\n if (current === null || typeof current !== \"object\" || !(part in current)) {\n // Return the default value, if provided\n if (arguments.length === 3) return defaultValue as T;\n\n // Else, throw a debug error with the trace path\n const reach = trace.join(\".\");\n throw new Error(`get: Path broken at \"${reach}\". ` + `Property \"${part}\" is missing on ${typeof current}.`);\n }\n\n current = current[part];\n }\n\n // Handle the case where the final value found is undefined\n if (current === undefined && arguments.length === 3) {\n return defaultValue as T;\n }\n\n return current as T;\n}\n\n/**\n * Checks if a nested path exists within an object.\n * @param obj The object to process.\n * @param path The path string (e.g., 'data.users[0].id').\n */\nfunction has(obj: Record<string, any>, path: string): boolean {\n if (!obj || !path) return false;\n\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]!;\n\n // If the current level isn't an object, the path can't continue\n if (current === null || typeof current !== \"object\") {\n return false;\n }\n\n // Check if the property exists at this level\n if (!(part in current)) {\n return false;\n }\n\n current = current[part];\n }\n\n return true;\n}\n\n/**\n * Sets a nested property value. Creates missing objects/arrays along the path.\n * @param obj The object to process.\n * @param path The path to set (e.g., 'data.users[0].id').\n * @param value The value to inject.\n */\nfunction set(obj: Record<string, any>, path: string, value: any): void {\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]!;\n const isLast = i === parts.length - 1;\n\n if (isLast) {\n current[part] = value;\n return;\n }\n\n // If the next part is a number, we should create an array, otherwise an object\n const nextPartIsNumber = !isNaN(Number(parts[i + 1]));\n\n if (!(part in current) || current[part] === null || typeof current[part] !== \"object\") {\n current[part] = nextPartIsNumber ? [] : {};\n }\n\n current = current[part];\n }\n}\n\n/**\n * Deep merges multiple objects.\n * @param target - The base object to merge into.\n * @param sources - One or more objects to merge.\n */\nfunction merge<T, S1>(target: T, s1: S1): T & S1;\nfunction merge<T, S1, S2>(target: T, s1: S1, s2: S2): T & S1 & S2;\nfunction merge<T, S1, S2, S3>(target: T, s1: S1, s2: S2, s3: S3): T & S1 & S2 & S3;\nfunction merge(target: any, ...sources: any[]): any;\nfunction merge(target: any, ...sources: any[]) {\n // Loop through every source object provided\n for (const source of sources) {\n if (!source) continue;\n\n Object.keys(source).forEach(key => {\n const targetValue = target[key];\n const sourceValue = source[key];\n\n if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {\n // Concat arrays\n (target as any)[key] = targetValue.concat(sourceValue);\n } else if (\n targetValue &&\n typeof targetValue === \"object\" &&\n sourceValue &&\n typeof sourceValue === \"object\" &&\n !Array.isArray(sourceValue)\n ) {\n // If both are objects, recurse\n merge(targetValue, sourceValue);\n } else {\n // Else, just set the value\n (target as any)[key] = sourceValue;\n }\n });\n }\n\n return target;\n}\n\n/**\n * Creates an object composed of the picked object properties.\n * @param obj The object to process.\n * @param keys The keys to pick from the object.\n */\nfunction pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) {\n if (key in obj) {\n result[key] = obj[key];\n }\n }\n return result;\n}\n\n/**\n * Creates an object composed of the omitted object properties.\n * @param obj The object to process.\n * @param keys The keys to omit from the object.\n */\nfunction omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n for (const key of keys) {\n delete result[key];\n }\n return result;\n}\n\nexport { get, has, set, merge, pick, omit };\n","/**\n * Escapes regex characters in the given string.\n * @param str - The string to process.\n */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Retrieves a substring following a specific flag.\n * @param str The string to process.\n * @param flag A string or regex to look for.\n */\nfunction getFlag(str: string, flag: string | RegExp, length?: number): string | null {\n // NOTE: Using \\b ensures we don't match \"flag\" inside \"flagpole\"\n const regex = flag instanceof RegExp ? flag : new RegExp(`${escapeRegex(flag)}\\\\b`, \"g\");\n\n const match = regex.exec(str);\n if (!match) return null;\n\n const startIndex = match.index + match[0].length;\n let result = str.slice(startIndex).trimStart();\n\n // If length is provided, limit by word count\n if (length !== undefined) {\n return result.split(/\\s+/).slice(0, length).join(\" \");\n }\n\n return result || null;\n}\n\n/**\n * Checks if a string contains a specific flag.\n * @param str The string to process.\n * @param flag A string or regex to look for.\n */\nfunction hasFlag(str: string, flag: string | RegExp): boolean {\n if (flag instanceof RegExp) return flag.test(str);\n\n // NOTE: Using \\b ensures we don't match \"flag\" inside \"flagpole\"\n const pattern = new RegExp(`${escapeRegex(flag)}\\\\b`);\n return pattern.test(str);\n}\n\n/**\n * Formats a string to Title Case, optionally keeping acronyms and skipping minor words (the, and, of, etc.).\n * @param str The string to process.\n * @param smart If true, will keep acronyms and skip minor words. [default: true]\n */\nfunction toTitleCase(str: string, smart = true): string {\n const minorWords = /^(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\\.?|via)$/i;\n\n return str.replace(/\\w\\S*/g, (txt, index) => {\n // Always capitalize the first word, otherwise check if it's a minor word\n if (smart && index !== 0 && minorWords.test(txt)) {\n return txt.toLowerCase();\n }\n\n // If it's already uppercase (more than 1 letter), assume it's an acronym\n if (smart && txt.length > 1 && txt === txt.toUpperCase()) {\n return txt;\n }\n\n return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();\n });\n}\n\nexport { escapeRegex, getFlag, hasFlag, toTitleCase };\n","export interface DebouncedFunction<T extends (...args: any[]) => any> {\n (...args: Parameters<T>): void;\n /** Cancels the debounced function. */\n cancel: () => void;\n}\n\n/**\n * Only executes after 'wait' ms have passed since the last call.\n * @param fn The function to debounce.\n * @param wait The time to wait in milliseconds.\n * @param options Options for the debounce function.\n * @example\n * const search = debounce((str) => console.log(\"Searching:\", str), 500);\n * // Even if called rapidly, it only logs once 500ms after the last call.\n * search('a');\n * search('ab');\n * search('abc'); // Only 'abc' will be logged.\n * // Cancel a pending execution\n * search.cancel();\n */\nfunction debounce<T extends (...args: any[]) => any>(\n fn: T,\n wait: number,\n options: {\n /** Calls the function immediately on the leading edge. */\n immediate?: boolean;\n } = {}\n): DebouncedFunction<T> {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const leading = options.immediate ?? false;\n\n const debounced = function (this: any, ...args: Parameters<T>) {\n const callNow = leading && !timeoutId;\n if (timeoutId) clearTimeout(timeoutId);\n\n timeoutId = setTimeout(() => {\n timeoutId = undefined;\n // If we aren't in leading mode, fire the function at the end\n if (!leading) fn.apply(this, args);\n }, wait);\n\n // If leading is true and no timer was active, fire immediately\n if (callNow) fn.apply(this, args);\n } as DebouncedFunction<T>;\n\n debounced.cancel = () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n };\n\n return debounced;\n}\n\n/**\n * Executes at most once every 'limit' ms.\n * @param fn The function to throttle.\n * @param limit The time to wait in milliseconds.\n * @example\n * const handleScroll = throttle(() => console.log('Scroll position:', window.scrollY), 200);\n * // Even if the browser fires 100 scroll events per second,\n * // this function will only execute once every 200ms.\n * window.addEventListener('scroll', handleScroll);\n */\nfunction throttle<T extends (...args: any[]) => any>(fn: T, limit: number): (...args: Parameters<T>) => void {\n let inThrottle = false;\n\n return function (this: any, ...args: Parameters<T>) {\n if (!inThrottle) {\n fn.apply(this, args);\n inThrottle = true;\n setTimeout(() => (inThrottle = false), limit);\n }\n };\n}\n\nexport { debounce, throttle };\n","export type ToRecordContext<T, V> = {\n index: number;\n lastValue: V | undefined;\n newRecord: Readonly<Record<string | number, V>>;\n originalArray: ReadonlyArray<T>;\n};\n\n/**\n * Transforms an array into a object record with access to the object as it's being built.\n * @param array Array to process.\n * @param callback Function to map over the array.\n */\nfunction record<T, V>(\n array: ReadonlyArray<T>,\n callback: (item: T, context: ToRecordContext<T, V>) => { key: string | number; value: V }\n): Record<string | number, V> {\n const result: Record<string | number, V> = {};\n let lastValue: V | undefined = undefined;\n\n for (let i = 0; i < array.length; i++) {\n const { key, value } = callback(array[i]!, {\n index: i,\n lastValue,\n // NOTE: This is a reference to the object currently being built\n newRecord: result,\n originalArray: array\n });\n\n result[key] = value;\n lastValue = value;\n }\n\n return result;\n}\n\nexport { record };\n","/**\n * Pipes a value through a series of functions.\n * Each function takes the output of the previous one.\n */\nexport function Pipe<A>(value: A): A;\nexport function Pipe<A, B>(value: A, fn1: (arg: A) => B): B;\nexport function Pipe<A, B, C>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C): C;\nexport function Pipe<A, B, C, D>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D): D;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n\nexport function Pipe(value: any, ...fns: Function[]): any {\n return fns.reduce((acc, fn) => fn(acc), value);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\ntype StorePayload<T> = {\n value: T;\n expiry: number | null;\n};\n\nexport class Storage {\n private isNode = typeof window === \"undefined\";\n private filePath: string | null = null;\n private memoryCache = new Map<string, string>();\n\n private loadFromFile() {\n if (this.filePath && fs.existsSync(this.filePath)) {\n try {\n const data = JSON.parse(fs.readFileSync(this.filePath, \"utf-8\"));\n Object.entries(data).forEach(([k, v]) => this.memoryCache.set(k, JSON.stringify(v)));\n } catch (err) {\n console.error(`Store: Failed to load file '${this.filePath}'`, err);\n }\n }\n }\n\n private persist() {\n if (this.isNode && this.filePath) {\n const out: Record<string, any> = {};\n this.memoryCache.forEach((v, k) => (out[k] = JSON.parse(v)));\n fs.writeFileSync(this.filePath, JSON.stringify(out, null, 2));\n }\n }\n\n /**\n * A lightweight, high-performant persistent storage system.\n * Uses JSON files in Node.js, localStorage in the browser.\n * @param fileName Only used in Node.js to create a persistent .json file.\n * @param directory The directory for the file. Defaults to current working directory.\n */\n constructor(fileName?: string, directory: string = process.cwd()) {\n if (this.isNode && fileName) {\n this.filePath = path.join(directory, fileName.endsWith(\".json\") ? fileName : `${fileName}.json`);\n this.loadFromFile();\n }\n }\n\n has(key: string): boolean {\n if (!this.isNode && window.localStorage) {\n return localStorage.getItem(key) !== null;\n }\n return this.memoryCache.has(key);\n }\n\n get<T>(key: string): T | null {\n let raw: string | null = null;\n\n if (!this.isNode && window.localStorage) {\n raw = localStorage.getItem(key);\n } else {\n raw = this.memoryCache.get(key) || null;\n }\n\n if (!raw) return null;\n\n const payload: StorePayload<T> = JSON.parse(raw);\n if (payload.expiry && Date.now() > payload.expiry) {\n this.remove(key);\n this.persist();\n return null;\n }\n return payload.value;\n }\n\n set<T>(key: string, value: T, ttl?: number): void {\n const payload: StorePayload<T> = {\n value,\n expiry: ttl ? Date.now() + ttl : null\n };\n const serialized = JSON.stringify(payload);\n\n if (!this.isNode && window.localStorage) {\n localStorage.setItem(key, serialized);\n } else {\n this.memoryCache.set(key, serialized);\n this.persist();\n }\n }\n\n remove(key: string): void {\n if (!this.isNode && window.localStorage) {\n localStorage.removeItem(key);\n } else {\n this.memoryCache.delete(key);\n this.persist();\n }\n }\n\n clear(): void {\n if (!this.isNode && window.localStorage) {\n localStorage.clear();\n } else {\n this.memoryCache.clear();\n this.persist();\n }\n }\n}\n","export class Cache<T> {\n private cache = new Map<string | number, { value: T; expiresAt: number | null }>();\n private interval: any;\n\n /**\n * A lightweight, high-performant in-memory cache.\n * Uses Map for O(1) lookups and an optional cleanup interval.\n * @param cleanupMs The interval in milliseconds to run the cleanup function. [default: 60000 (1 minute)]\n */\n constructor(cleanupMs: number = 60_000) {\n // Only run cleanup if the interval is positive\n if (cleanupMs > 0) {\n this.interval = setInterval(() => this.cleanup(), cleanupMs);\n // In Node.js, allow the process to exit even if this interval is running\n if (this.interval.unref) this.interval.unref();\n }\n }\n\n set(key: string | number, value: T, ttlMs?: number): void {\n this.cache.set(key, {\n value,\n expiresAt: ttlMs ? Date.now() + ttlMs : null\n });\n }\n\n get(key: string | number): T | null {\n const data = this.cache.get(key);\n if (!data) return null;\n\n if (data.expiresAt && Date.now() > data.expiresAt) {\n // Passive cleanup\n this.cache.delete(key);\n return null;\n }\n return data.value;\n }\n\n private cleanup(): void {\n if (this.cache.size === 0) return;\n\n const now = Date.now();\n let keysProcessed = 0;\n const maxKeysToScan = 20; // Limit per cycle to avoid CPU spikes\n\n // Iterate through the map\n for (const [key, data] of this.cache) {\n if (data.expiresAt && now > data.expiresAt) {\n this.cache.delete(key);\n }\n\n keysProcessed++;\n if (keysProcessed >= maxKeysToScan) break;\n }\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n","import EventEmitter from \"node:events\";\nimport { TypedEmitter } from \"./types\";\n\nexport type LoopState = \"running\" | \"paused\" | \"stopped\";\n\nexport interface LoopEvents<T> {\n start: [];\n tick: [result: T];\n pause: [{ remaining: number }];\n resume: [];\n stop: [];\n error: [error: any];\n}\n\nconst TypedEmitterBase = EventEmitter as { new <T>(): TypedEmitter<LoopEvents<T>> };\n\nexport class Loop<T = any> extends TypedEmitterBase<T> {\n private _state: LoopState = \"stopped\";\n private timeoutId: any = null;\n private delay: number;\n private fn: (loop: Loop<T>) => Promise<T> | T;\n\n private startTime: number = 0;\n private remaining: number = 0;\n\n private async run() {\n const currentState: LoopState = this._state;\n\n if (currentState === \"stopped\" || currentState === \"paused\") return;\n\n try {\n const result = await this.fn(this);\n this.emit(\"tick\", result);\n } catch (err) {\n this.emit(\"error\", err);\n }\n\n // Re-check state after the async function finishes\n if (this._state === \"running\") {\n this.startTime = Date.now();\n this.remaining = 0;\n this.clearTimer();\n this.timeoutId = setTimeout(() => this.run(), this.delay);\n }\n }\n\n private clearTimer() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n\n /**\n * Creates an interval. If the function is async, it will wait for it to complete before scheduling the next run.\n * @param fn The function to run.\n * @param delay The delay between runs in milliseconds.\n * @param immediate Whether to start the loop immediately. [default: true]\n */\n constructor(fn: (loop: Loop<T>) => Promise<T> | T, delay: number, immediate = true) {\n super();\n this.fn = fn;\n this.delay = delay;\n if (immediate) this.start();\n }\n\n get state(): LoopState {\n return this._state;\n }\n\n /** Starts the loop. */\n start() {\n if (this._state !== \"stopped\") return;\n this._state = \"running\";\n this.emit(\"start\");\n this.run();\n }\n\n /** Resumes a paused loop. */\n resume() {\n if (this._state !== \"paused\") return;\n this._state = \"running\";\n this.emit(\"resume\");\n if (this.remaining <= 0) {\n this.run();\n } else {\n this.timeoutId = setTimeout(() => this.run(), this.remaining);\n }\n }\n\n /** Stops the loop. */\n stop() {\n const wasRunning = this._state !== \"stopped\";\n this._state = \"stopped\";\n this.remaining = 0;\n this.clearTimer();\n if (wasRunning) this.emit(\"stop\");\n }\n\n /** Pauses the execution. */\n pause() {\n if (this._state !== \"running\") return;\n this._state = \"paused\";\n const elapsed = Date.now() - this.startTime;\n this.remaining = Math.max(0, this.delay - elapsed);\n this.emit(\"pause\", { remaining: this.remaining });\n this.clearTimer();\n }\n\n /**\n * Sets the delay between runs\n * @param ms The new delay in milliseconds.\n */\n setDelay(ms: number) {\n this.delay = ms;\n }\n\n /** Manually trigger the function once without affecting the loop. */\n async execute() {\n await this.fn(this);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,IAAM,QAAQ;AACd,IAAM,QAAQ;AACd,IAAM,MAAM;AAOZ,SAAS,OAAOA,WAAkB,KAAK,MAAwB;AAC3D,MAAIA,YAAW,EAAG,QAAO;AACzB,MAAIA,YAAW,EAAG,QAAO;AACzB,QAAM,SAAS,SAAS,SAAY,KAAK,IAAI,IAAI,KAAK;AACtD,SAAO,OAAO,IAAIA;AACtB;AAOA,SAAS,OAAU,OAAY,UAA8B,CAAC,GAAM;AAChE,QAAM,EAAE,MAAM,KAAK,aAAa,GAAG,IAAI;AACvC,QAAM,SAAS,SAAS,SAAY,KA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,QAAI,KAAK,WAAW,UAAW;AAC/B,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,IAAI,IAAI,KAAK;AAClC,SAAK,YAAY,KAAK,IAAI,GAAG,KAAK,QAAQ,OAAO;AACjD,SAAK,KAAK,SAAS,EAAE,WAAW,KAAK,UAAU,CAAC;AAChD,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAASC,KAAY;AACjB,SAAK,QAAQA;AAAA,EACjB;AAAA;AAAA,EAGA,MAAM,UAAU;AACZ,UAAM,KAAK,GAAG,IAAI;AAAA,EACtB;AACJ;;;AjBvGA,IAAM,OAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEO,IAAM,IAAI;AACjB,IAAO,gBAAQ;","names":["percent","index","seed","ms","ms","str","path","_fs","today","path","str","index","wait","import_node_fs","import_node_path","fs","path","EventEmitter","ms"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/arr.ts","../src/rnd.ts","../src/async.ts","../src/fn.ts","../src/date.ts","../src/format.ts","../src/fs.ts","../src/is.ts","../src/math.ts","../src/obj.ts","../src/str.ts","../src/timing.ts","../src/to.ts","../src/Pipe.ts","../src/Storage.ts","../src/Cache.ts","../src/Loop.ts","../src/index.ts"],"sourcesContent":["import * as rnd from \"./rnd\";\n\nexport type SequentialMapContext<T, U> = {\n index: number;\n lastElement: U | undefined;\n newArray: ReadonlyArray<U>;\n originalArray: ReadonlyArray<T>;\n};\n\n/**\n * Splits an array into sub-arrays (chunks) of a maximum size.\n * @param array Array to process.\n * @param size The maximum size of each chunk.\n */\nfunction chunk<T>(array: ReadonlyArray<T>, size: number): T[][] {\n if (size <= 0) throw new Error(\"chunk: Size must be a positive integer.\");\n\n const result: T[][] = [];\n const len = array.length;\n\n for (let i = 0; i < len; i += size) {\n result.push(array.slice(i, i + size));\n }\n\n return result;\n}\n\n/**\n * Groups adjacent elements of an array together based on a predicate.\n * @param array Array to process.\n * @param predicate A function that returns true if two adjacent elements belong in the same chunk.\n * @example\n * // Group consecutive identical numbers\n * chunkBy([1, 1, 2, 3, 3, 3], (a, b) => a === b);\n * // [[1, 1], [2], [3, 3, 3]]\n */\nfunction chunkAdj<T>(array: ReadonlyArray<T>, predicate: (prev: T, curr: T) => boolean): T[][] {\n if (array.length === 0) return [];\n\n const results: T[][] = [];\n const len = array.length;\n let currentChunk: T[] = [array[0]!];\n\n for (let i = 1; i < len; i++) {\n const prev = array[i - 1]!;\n const curr = array[i]!;\n\n if (predicate(prev, curr)) {\n currentChunk.push(curr);\n } else {\n results.push(currentChunk);\n currentChunk = [curr];\n }\n }\n\n results.push(currentChunk);\n return results;\n}\n\n/**\n * Groups elements by a key.\n * @param array Array to process.\n * @param iteratee Function to determine the key to group by.\n * @param maxChunkSize Optionally chunk groups and flatten them (useful for pagination).\n */\nfunction cluster<T>(array: ReadonlyArray<T>, iteratee: (item: T) => string | number, maxChunkSize?: number): T[][] {\n const groups = new Map<string | number, T[]>();\n\n for (const item of array) {\n const key = iteratee(item);\n const collection = groups.get(key);\n if (!collection) {\n groups.set(key, [item]);\n } else {\n collection.push(item);\n }\n }\n\n const result: T[][] = [];\n\n for (const group of groups.values()) {\n if (maxChunkSize && maxChunkSize > 0) {\n // If chunking is enabled, split this specific group\n for (let i = 0; i < group.length; i += maxChunkSize) {\n result.push(group.slice(i, i + maxChunkSize));\n }\n } else {\n // Otherwise, just push the whole group as one chunk\n result.push(group);\n }\n }\n\n return result;\n}\n\n/**\n * Removes unwanted values from an array.\n * @param array Array to process.\n * @param mode 'nullable' (default) removes null/undefined. 'falsy' removes null, undefined, 0, \"\", false, and NaN.\n */\nfunction compact<T>(array: ReadonlyArray<T>, mode?: \"nullable\"): NonNullable<T>[];\nfunction compact<T>(array: ReadonlyArray<T>, mode: \"falsy\"): Exclude<T, null | undefined | false | 0 | \"\">[];\nfunction compact<T>(array: ReadonlyArray<T>, mode: \"nullable\" | \"falsy\" = \"nullable\"): any[] {\n if (mode === \"falsy\") {\n // Boolean constructor handles all falsy values\n return array.filter(Boolean);\n }\n\n // Only removes null and undefined\n return array.filter(item => item !== null && item !== undefined);\n}\n\n/**\n * Forces a given item to be an array.\n * @param item The item to force into an array.\n */\nfunction forceArray<T>(item: T): T[] {\n return Array.isArray(item) ? item : [item];\n}\n\n/**\n * Searches a sorted array for a value using the binary search method.\n * Returns the index if found, or the bitwise complement (~index) of the\n * position where the value should be inserted to keep it sorted.\n * @param array The array to process.\n * @param target The value to search for.\n * @param comparator Optional comparator function.\n */\nfunction search<T>(\n array: T[],\n target: T,\n comparator: (a: T, b: T) => number = (a, b) => (a > b ? 1 : a < b ? -1 : 0)\n): number {\n let low = 0;\n let high = array.length - 1;\n\n while (low <= high) {\n const mid = (low + high) >>> 1;\n const comp = comparator(array[mid]!, target);\n\n if (comp < 0) low = mid + 1;\n else if (comp > 0) high = mid - 1;\n else return mid;\n }\n\n return ~low;\n}\n\n/**\n * Maps over an array with access to the previously mapped elements.\n * @param array Array to process.\n * @param callback Function to map over the array.\n */\nfunction seqMap<T, U>(array: ReadonlyArray<T>, callback: (item: T, context: SequentialMapContext<T, U>) => U): U[] {\n const len = array.length;\n const result: U[] = new Array(len);\n\n for (let i = 0; i < len; i++) {\n result[i] = callback(array[i]!, {\n index: i,\n lastElement: i > 0 ? result[i - 1] : undefined,\n // NOTE: This is a reference to the array currently being built\n newArray: result,\n originalArray: array\n });\n }\n\n return result;\n}\n\n/**\n * Shuffles an array using the Fisher-Yates algorithm.\n * @param array The array to shuffle.\n * @param seed Optional seed for RNG.\n */\nfunction shuffle<T>(array: ReadonlyArray<T>, seed?: number): T[] {\n const random = seed !== undefined ? rnd.prng(seed) : Math.random;\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n const temp = result[i]!;\n result[i] = result[j]!;\n result[j] = temp;\n }\n\n return result;\n}\n\n/**\n * Sorts an array by a single property in order.\n * @param order 'asc' for ascending (default) or 'desc' for descending.\n * @param array Array to process.\n * @param selector Function to determine the key to sort by.\n */\nfunction sortBy<T>(array: ReadonlyArray<T>, selector: (item: T) => any, order?: \"asc\" | \"desc\"): T[];\n/**\n * Sorts an array by one or more properties in order.\n * @param order 'asc' for ascending (default) or 'desc' for descending.\n * @param array Array to process.\n * @param selectors Functions to determine the keys to sort by.\n */\nfunction sortBy<T>(array: ReadonlyArray<T>, selectors: (item: T) => any[], order?: \"asc\" | \"desc\"): T[];\nfunction sortBy<T>(\n array: ReadonlyArray<T>,\n selectorOrSelectors: (item: T) => any | ((item: T) => any)[],\n order: \"asc\" | \"desc\" = \"asc\"\n): T[] {\n const selectors = Array.isArray(selectorOrSelectors) ? selectorOrSelectors : [selectorOrSelectors];\n\n if (array.length === 0 || selectors.length === 0) {\n return [...array];\n }\n\n const modifier = order === \"desc\" ? -1 : 1;\n const memos = array.map(item => ({ item, keys: selectors.map(s => s(item)) }));\n\n memos.sort((a, b) => {\n for (let i = 0; i < selectors.length; i++) {\n const valA = a.keys[i];\n const valB = b.keys[i];\n\n if (valA === valB) continue;\n\n // Nullish values are pushed to the end regardless of order\n if (valA == null) return 1;\n if (valB == null) return -1;\n\n if (valA < valB) return -1 * modifier;\n if (valA > valB) return 1 * modifier;\n }\n return 0;\n });\n\n return memos.map(m => m.item);\n}\n\n/**\n * Returns an array of unique elements from the given array.\n * Uniqueness is determined by the given key function.\n * @param array Array to process.\n * @param key Function to determine the keys to filter by\n */\nfunction unique<T>(array: T[], key: (item: T) => any): T[] {\n return Array.from(new Map(array.map(item => [key(item), item])).values());\n}\n\nexport { chunk, chunkAdj, cluster, compact, forceArray, search, seqMap, shuffle, sortBy, unique };\n","export type AlphaCasing = \"lower\" | \"upper\" | \"mixed\";\n\nexport interface RndArrayOptions<T> {\n /** Optional seed for RNG. */\n seed?: number;\n /** Reroll if the result is equal to this value. */\n not?: ((item: T) => boolean) | (T | null | undefined);\n /** Maximum number of times to reroll if `not` is specified. [default: 10] */\n maxRerolls?: number;\n}\n\nexport interface RndStrOptions {\n /** Optional seed for RNG. */\n seed?: number;\n /** Character casing mode. */\n casing?: AlphaCasing;\n /** Custom character pool. */\n customChars?: string;\n /** Characters to exclude from the pool. */\n exclude?: string | string[];\n}\n\nconst LOWER = \"abcdefghijklmnopqrstuvwxyz\";\nconst UPPER = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nconst NUM = \"0123456789\";\n\n/**\n * Returns true based on a percentage probability.\n * @param percent A value between 0 and 1. [default: 0.5]\n * @param seed Optional seed for RNG.\n */\nfunction chance(percent: number = 0.5, seed?: number): boolean {\n if (percent <= 0) return false;\n if (percent >= 1) return true;\n const random = seed !== undefined ? prng(seed) : Math.random;\n return random() < percent;\n}\n\n/**\n * Returns a random item from the given array.\n * @param array Array of items to choose from.\n * @param options Options for the choice function.\n */\nfunction choice<T>(array: T[], options: RndArrayOptions<T> = {}): T {\n const { seed, not, maxRerolls = 10 } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n const rnd = () => array[Math.floor(random() * array.length)]!;\n\n let result: T = rnd();\n\n // NOTE: Ignores rerolling if seed is set and result is equal to `not`\n // to prevent infinite loops\n if (seed === undefined && array.length > 1 && not !== undefined) {\n let rerolls = 0;\n\n const shouldReroll = () => (typeof not === \"function\" ? (not as (item: T) => boolean)(result) : result === not);\n while (shouldReroll() && rerolls < maxRerolls) {\n result = rnd();\n rerolls++;\n }\n }\n\n return result;\n}\n\n/**\n * Returns a random item from the given array based on their corresponding weights.\n * @param array Array of items to choose from.\n * @param selector Function that selects the item's weight.\n * @param seed Optional seed for RNG.\n */\nfunction weighted<T>(array: T[], selector: (item: T) => number, seed?: number): T {\n const random = seed !== undefined ? prng(seed) : Math.random;\n\n const cumulativeWeights: number[] = [];\n let currentSum = 0;\n\n // Calculate cumulative weights\n for (const item of array) {\n const weight = selector(item);\n currentSum += weight;\n cumulativeWeights.push(currentSum);\n }\n\n const decider = random() * currentSum;\n\n let index: number;\n\n // Linear search | O(n)\n if (array.length < 20) {\n index = cumulativeWeights.findIndex(w => w >= decider);\n }\n // Binary Search | O(log n)\n else {\n let low = 0;\n let high = cumulativeWeights.length - 1;\n\n while (low < high) {\n const mid = (low + high) >>> 1;\n if (decider > cumulativeWeights[mid]!) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n index = low;\n }\n\n return array[index]!;\n}\n\n/**\n * Returns an object with a single method, `pick`, which returns a random item from the given array in O(1) time.\n * The probability of each item being picked is determined by the corresponding weight in the `weights` array.\n * @param items Array of items to choose from.\n * @param selector Function that selects the item's weight.\n * @param seed Optional seed for RNG.\n */\nfunction sampler<T>(items: T[], selector: (item: T) => number, seed?: number) {\n const callRandom = seed ? prng(seed) : undefined;\n const len = items.length;\n\n const prob = new Array(len);\n const alias = new Array(len);\n\n const weights = items.map(selector);\n const totalWeight = weights.reduce((a, b) => a + b, 0);\n const scaledWeights = weights.map(w => (w * len) / totalWeight);\n\n const small: number[] = [];\n const large: number[] = [];\n\n scaledWeights.forEach((w, i) => (w < 1 ? small : large).push(i));\n\n while (small.length && large.length) {\n const s = small.pop()!;\n const l = large.pop()!;\n prob[s] = scaledWeights[s];\n alias[s] = l;\n scaledWeights[l] = scaledWeights[l]! + scaledWeights[s]! - 1;\n (scaledWeights[l] < 1 ? small : large).push(l);\n }\n\n while (large.length) prob[large.pop()!] = 1;\n while (small.length) prob[small.pop()!] = 1;\n\n return {\n /**\n * Returns a random item from the given array in O(1) time.\n * @param seed Optional seed for RNG.\n */\n pick: (seed?: number) => {\n const random = seed !== undefined ? prng(seed) : callRandom || Math.random;\n const i = Math.floor(random() * len);\n return random() < prob[i] ? items[i] : items[alias[i]];\n }\n };\n}\n\n/**\n * Creates a deterministic pseudo-random number generator (PRNG) using the Mulberry32 algorithm.\n * @param seed An integer seed value.\n * @example\n * const rng = prng(123);\n * const val1 = rng(); // Always the same for seed 123\n */\nfunction prng(seed: number): () => number {\n return () => {\n let t = (seed += 0x6d2b79f5);\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/**\n * Generates a random float between the given minimum and maximum values.\n * @param min The minimum value (inclusive) for the random float.\n * @param max The maximum value (inclusive) for the random float.\n * @param seed Optional seed for RNG.\n */\nfunction float(min: number, max: number, seed?: number): number {\n const random = seed !== undefined ? prng(seed) : Math.random;\n return random() * (max - min) + min;\n}\n\n/**\n * Returns a random index from the given array.\n * @param array The array to generate an index for.\n * @param options Options for the index function.\n */\nfunction index<T>(array: T[], options: RndArrayOptions<number> = {}): number {\n const { seed, not, maxRerolls = 10 } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n const rnd = () => Math.floor(random() * array.length);\n\n let result: number = rnd();\n\n // NOTE: Ignores rerolling if seed is set and result is equal to `not`\n // to prevent infinite loops\n if (seed === undefined && array.length > 1 && not !== undefined) {\n let rerolls = 0;\n\n const shouldReroll = () => (typeof not === \"function\" ? (not as (item: number) => boolean)(result) : result === not);\n while (shouldReroll() && rerolls < maxRerolls) {\n result = rnd();\n rerolls++;\n }\n }\n\n return result;\n}\n\n/**\n * Generates a random integer between the given minimum and maximum values.\n * @param min The minimum value (inclusive) for the random integer.\n * @param max The maximum value (inclusive) for the random integer.\n * @param seed Optional seed for RNG.\n */\nfunction int(min: number, max: number, seed?: number): number {\n const random = seed !== undefined ? prng(seed) : Math.random;\n return Math.floor(random() * (max - min + 1)) + min;\n}\n\n/**\n * Generates a random string of the given length using the specified character pool.\n * @param len The length of the random string.\n * @param mode The character pool to use. Can be \"number\", \"alpha\", \"alphanumeric\", or \"custom\".\n * @param options Options for the rndStr function.\n */\nfunction str(len: number, mode: \"number\" | \"alpha\" | \"alphanumeric\" | \"custom\", options: RndStrOptions = {}) {\n const { casing = \"lower\", seed, customChars = \"\", exclude = \"\" } = options;\n const random = seed !== undefined ? prng(seed) : Math.random;\n\n const alphaPool = { lower: LOWER, upper: UPPER, mixed: LOWER + UPPER }[casing];\n let pool = { number: NUM, alpha: alphaPool, alphanumeric: alphaPool + NUM, custom: customChars }[mode];\n\n if (exclude.length > 0) {\n const excludeSet = new Set(Array.isArray(exclude) ? exclude : exclude.split(\"\"));\n pool = pool\n .split(\"\")\n .filter(char => !excludeSet.has(char))\n .join(\"\");\n }\n\n // Safety check\n if (pool.length === 0) throw new Error(\"rndStr: Character pool is empty after exclusions.\");\n\n const result = new Array(len);\n const poolLen = pool.length;\n\n for (let i = 0; i < len; i++) {\n result[i] = pool[Math.floor(random() * poolLen)];\n }\n\n return result.join(\"\");\n}\n\nexport { chance, choice, weighted, sampler, prng, float, index, int, str };\n","/**\n * Retries an async function with exponential backoff.\n * @param fn The async function to attempt.\n * @param retries Maximum number of retry attempts. [default: 3]\n * @param delay Initial delay in milliseconds. [default: 500ms]\n */\nasync function retry<T>(fn: () => Promise<T>, retries: number = 3, delay: number = 500): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n if (retries <= 0) throw error;\n const jitter = Math.random() * 200;\n return await new Promise(resolve => setTimeout(resolve, delay + jitter));\n }\n}\n\n/**\n * Returns a promise that resolves after the given number of milliseconds.\n * @param ms The time to wait in milliseconds.\n */\nfunction wait(ms: number): Promise<boolean> {\n return new Promise(resolve =>\n setTimeout(() => {\n resolve(true);\n }, ms)\n );\n}\n\nexport { retry, wait };\n","export interface MemoizedFunction<T extends (...args: any[]) => any> {\n (...args: Parameters<T>): ReturnType<T>;\n /** Clears the cache. */\n clear: () => void;\n}\n\n/**\n * Memoizes a function by caching its results based on the input arguments.\n * A resolver function can be provided to customize the key generation.\n * If no resolver is provided, the key will be generated by JSON stringify-ing the input arguments.\n * @param fn The function to memoize.\n * @param resolver An optional resolver function to customize the key generation.\n * @example\n * // 1. Basic usage\n * const heavyCalc = memoize((n: number) => {\n * console.log('Calculating...');\n * return n * 2;\n * });\n * heavyCalc(5); // Logs 'Calculating...' and returns 10\n * heavyCalc(5); // Returns 10 immediately from cache\n * @example\n * // 2. Using maxAge (TTL)\n * const getStockPrice = memoize(fetchPrice, { maxAge: 60000 }); // 1 minute cache\n * @example\n * // 3. Using a custom resolver\n * const getUser = memoize(\n * (user, theme) => render(user, theme),\n * { resolver: (user) => user.id } // Only cache based on ID, ignore theme\n * );\n * @example\n * // 4. Manual cache clearing\n * heavyCalc.clear();\n */\nfunction memoize<T extends (...args: any[]) => any>(\n fn: T,\n options: {\n /** Function to generate a cache key from the input arguments. */\n resolver?: (...args: Parameters<T>) => string;\n /** The time to wait in milliseconds before expiring a cache entry. */\n maxAge?: number;\n } = {}\n): MemoizedFunction<T> {\n const cache = new Map<string, { value: any; timestamp: number }>();\n const { resolver, maxAge } = options;\n\n const memoized = function (this: any, ...args: Parameters<T>) {\n const key = resolver ? resolver(...args) : JSON.stringify(args);\n const now = Date.now();\n const entry = cache.get(key);\n\n // Check if we have a valid (unexpired) entry\n if (entry) {\n if (!maxAge || now - entry.timestamp < maxAge) {\n return entry.value;\n }\n // Delete it since it's expired\n cache.delete(key);\n }\n\n const result = fn.apply(this, args);\n cache.set(key, { value: result, timestamp: now });\n return result;\n } as MemoizedFunction<T>;\n\n memoized.clear = () => cache.clear();\n\n return memoized;\n}\n\nexport { memoize };\n","export interface DateOptions {\n /** The reference timestamp to calculate from. Defaults to Date.now() */\n since?: number | Date;\n /** If true, returns null if the target time is in the past. */\n nullIfPast?: boolean;\n /** If true, omits the \" ago\" suffix for past dates. */\n ignorePast?: boolean;\n}\n\nexport interface ParseOptions {\n /** Return value in seconds instead of milliseconds. */\n unit?: \"ms\" | \"s\";\n /** If true, returns the absolute Unix timestamp (Date.now() + result). */\n fromNow?: boolean;\n}\n\nconst MS_MAP: Record<string, number> = {\n ms: 1,\n s: 1000,\n m: 60000,\n h: 3600000,\n d: 86400000,\n w: 604800000,\n mth: 2419200000,\n y: 31536000000\n};\n\n/**\n * Duration formatter.\n *\n * Available styles:\n * - Digital (00:00)\n * - HMS\n * - YMDHMS.\n * @param target The target time to calculate from.\n * @param style The output style to use.\n * @param options Formatting options.\n */\nfunction duration(\n target: number | Date,\n style: \"digital\" | \"hms\" | \"ymdhms\" = \"hms\",\n options: DateOptions = {}\n): string | null {\n const targetMs = target instanceof Date ? target.getTime() : Number(target);\n const sinceMs = options.since instanceof Date ? options.since.getTime() : Number(options.since) || Date.now();\n const diff = Math.abs(targetMs - sinceMs);\n\n if (diff === 0) return style === \"digital\" ? \"00:00\" : \"now\";\n\n const s = Math.floor(diff / 1000) % 60;\n const m = Math.floor(diff / 60000) % 60;\n const h = Math.floor(diff / 3600000) % 24;\n const d = Math.floor(diff / 86400000);\n\n if (style === \"digital\") {\n const parts = [m, s].map(v => String(v).padStart(2, \"0\"));\n if (h > 0 || d > 0) parts.unshift(String(h).padStart(2, \"0\"));\n if (d > 0) parts.unshift(String(d)); // Days don't necessarily need padding\n return parts.join(\":\");\n }\n\n const result: string[] = [];\n const push = (val: number, label: string) => {\n if (val > 0) result.push(`${val} ${label}${val === 1 ? \"\" : \"s\"}`);\n };\n\n if (style === \"ymdhms\") push(d, \"day\");\n push(h, \"hour\");\n push(m, \"minute\");\n push(s, \"second\");\n\n if (result.length === 0) return \"0 seconds\";\n if (result.length === 1) return result[0]!;\n\n const last = result.pop();\n return `${result.join(\", \")} and ${last}`;\n}\n\n/**\n * Formats a date or timestamp into a human-readable relative string (e.g., \"3 days ago\").\n * @param date - The Date object or timestamp to compare.\n * @param locale - The BCP 47 language tag.\n */\nfunction eta(date: Date | number, locale?: Intl.LocalesArgument): string {\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n const elapsed = (typeof date === \"number\" ? date : date.getTime()) - Date.now();\n\n // Division factors for different units\n const units: { unit: Intl.RelativeTimeFormatUnit; ms: number }[] = [\n { unit: \"year\", ms: 31536000000 },\n { unit: \"month\", ms: 2628000000 },\n { unit: \"day\", ms: 86400000 },\n { unit: \"hour\", ms: 3600000 },\n { unit: \"minute\", ms: 60000 },\n { unit: \"second\", ms: 1000 }\n ];\n\n // Find the largest unit that fits the elapsed time\n for (const { unit, ms } of units) {\n if (Math.abs(elapsed) >= ms || unit === \"second\") {\n return rtf.format(Math.round(elapsed / ms), unit);\n }\n }\n\n return \"\";\n}\n\n/**\n * Parses shorthand strings (1h 30m) into milliseconds or seconds.\n */\nfunction parse(str: string | number, options: ParseOptions = {}): number {\n if (typeof str === \"number\") return str;\n\n const matches = str.matchAll(/(-?\\d+)([a-z]+)/gi);\n let totalMs = 0;\n let found = false;\n\n for (const [_, value, unit] of matches) {\n if (!value || !unit) continue;\n const factor = MS_MAP[unit.toLowerCase()];\n if (factor) {\n totalMs += parseInt(value) * factor;\n found = true;\n }\n }\n\n if (!found) throw new Error(`parse: Invalid time format: \"${str}\"`);\n\n const result = options.unit === \"s\" ? totalMs / 1000 : totalMs;\n return options.fromNow ? Date.now() + result : result;\n}\n\nexport { duration, eta, parse };\n","/**\n * Formats a number as a currency string using international standards.\n * @param num - The number to process.\n * @param options - Formatting options.\n * @example\n * currency(1234.5); // \"$1,234.50\"\n * currency(1234.5, 'EUR', 'de-DE'); // \"1.234,50 €\"\n * currency(500, 'JPY'); // \"¥500\" (Yen has no decimals)\n */\nfunction currency(\n num: number,\n options: {\n /** The ISO currency code (e.g., 'USD', 'EUR', 'GBP'). */\n currency?: string;\n /** The BCP 47 language tag. */\n locale?: Intl.LocalesArgument;\n } = {}\n): string {\n return new Intl.NumberFormat(options.locale, {\n style: \"currency\",\n currency: options.currency\n }).format(num);\n}\n\n/**\n * Formats a number with thousands separators and optional decimal precision.\n * @param num - The number to process.\n * @param options - Formatting options.\n * @example\n * num(1000000); // \"1,000,000\" (en-US default)\n * num(1000, { locale: 'de-DE' }); // \"1.000\"\n * num(1234.567, { precision: 2 }); // \"1,234.57\"\n */\nfunction number(\n num: number,\n options: {\n /** The BCP 47 language tag. */\n locale?: Intl.LocalesArgument;\n precision?: number;\n } = {}\n): string {\n return new Intl.NumberFormat(options.locale, {\n minimumFractionDigits: options.precision,\n maximumFractionDigits: options.precision\n }).format(num);\n}\n\nfunction memory(\n bytes: number,\n decimals: number = 1,\n units: string[] = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n): string {\n // Handle 0 or negative numbers immediately\n if (bytes <= 0) return `0 ${units[0]}`;\n\n // Calculate the magnitude index (0 for B, 1 for KB, etc.)\n const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n const val = bytes / Math.pow(1024, i);\n return `${val.toFixed(i === 0 ? 0 : decimals)} ${units[i]}`;\n}\n\n/**\n * Formats a number to an ordinal (e.g., 1st, 2nd, 3rd).\n * @param num The number to process.\n * @param locale The BCP 47 language tag.\n */\nfunction ordinal(num: number | string, locale?: Intl.LocalesArgument): string {\n const _num = Number(num);\n if (isNaN(_num)) throw new TypeError(\"Invalid input\");\n\n const pr = new Intl.PluralRules(locale, { type: \"ordinal\" });\n const rule = pr.select(_num);\n\n const suffixes: Record<string, string> = {\n one: \"st\",\n two: \"nd\",\n few: \"rd\",\n other: \"th\"\n };\n\n const suffix = suffixes[rule] || \"th\";\n return _num.toLocaleString(locale) + suffix;\n}\n\n/**\n * Formats a number into a compact, human-readable string (e.g., 1.2k, 1M).\n * @param num - The number to process.\n * @param locale - The BCP 47 language tag.\n */\nfunction compactNumber(num: number, locale?: Intl.LocalesArgument): string {\n return new Intl.NumberFormat(locale, {\n notation: \"compact\",\n compactDisplay: \"short\",\n maximumFractionDigits: 1\n }).format(num);\n}\n\nexport { currency, number, memory, ordinal, compactNumber };\n","import _fs from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface ReadDirOptions {\n /** Whether to scan subdirectories. [default: true] */\n recursive?: boolean;\n}\n\n/**\n * Recursively (or shallowly) scans a directory and returns an array of relative file paths.\n * @param path The path to the directory.\n * @param options Options for the readDir function.\n */\nfunction readDir(path: string, options: ReadDirOptions = {}): string[] {\n const { recursive = true } = options;\n\n if (!_fs.existsSync(path)) return [];\n\n // Shallow read\n if (!recursive) {\n return _fs.readdirSync(path).filter(fn => {\n return _fs.statSync(join(path, fn)).isFile();\n });\n }\n\n // Recursive walk\n const walk = (dir: string, base: string = \"\"): string[] => {\n const results: string[] = [];\n\n // Using withFileTypes is much faster as it returns Dirent objects\n const entries = _fs.readdirSync(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const relativePath = base ? join(base, entry.name) : entry.name;\n const fullPath = join(dir, entry.name);\n\n if (entry.isDirectory()) {\n results.push(...walk(fullPath, relativePath));\n } else if (entry.isFile()) {\n results.push(relativePath);\n }\n }\n\n return results;\n };\n\n return walk(path);\n}\n\nexport { readDir };\n","/**\n * Checks if a value is defined (not null or undefined).\n */\nfunction defined<T>(val: T | undefined | null): val is T {\n return val !== undefined && val !== null;\n}\n\n/**\n * Checks if a value is an empty object, array, or string.\n */\nfunction empty(val: unknown): boolean {\n if (!defined(val)) return true;\n if (string(val) || Array.isArray(val)) return val.length === 0;\n if (object(val)) return Object.keys(val).length === 0;\n return false;\n}\n\n/**\n * Checks if a number is within a specified range.\n * @param num The number to check.\n * @param min The minimum or maximum value of the range.\n * @param max The maximum value of the range (optional).\n */\nfunction inRange(num: number, max: number): boolean;\nfunction inRange(num: number, min: number, max: number): boolean;\nfunction inRange(num: number, a: number, b?: number): boolean {\n // If b is undefined, we are clamping [0, a]\n // If b is defined, we are clamping [a, b]\n let min = b !== undefined ? a : 0;\n let max = b !== undefined ? b : a;\n\n // Handles a swapped min/max\n if (min > max) [min, max] = [max, min];\n return num >= min && num <= max;\n}\n\n/**\n * Checks if a value is a plain object (not an array, null, or function).\n */\nfunction object(val: unknown): val is Record<string, any> {\n return val !== null && typeof val === \"object\" && !Array.isArray(val);\n}\n\n/**\n * Checks if an array is sorted.\n */\nfunction sorted<T>(arr: T[], comparator?: (a: T, b: T) => number): boolean {\n for (let i = 0; i < arr.length - 1; i++) {\n const comp = comparator ? comparator(arr[i]!, arr[i + 1]!) : arr[i]! > arr[i + 1]! ? 1 : -1;\n if (comp > 0) return false;\n }\n return true;\n}\n\n/**\n * Checks if a value is a string.\n */\nfunction string(val: unknown): val is string {\n return typeof val === \"string\";\n}\n\n/**\n * Checks if a date is today.\n */\nfunction today(date: number | Date): boolean {\n const d = date instanceof Date ? date : new Date(date);\n const today = new Date();\n return d.getDate() === today.getDate() && d.getMonth() === today.getMonth() && d.getFullYear() === today.getFullYear();\n}\n\nexport { defined, empty, inRange, object, sorted, string, today };\n","/**\n * Clamps a number within a specified range.\n * @param num The number to check.\n * @param min The minimum or maximum value of the range.\n * @param max The maximum value of the range (optional).\n */\nfunction clamp(num: number, max: number): number;\nfunction clamp(num: number, min: number, max: number): number;\nfunction clamp(num: number, a: number, b?: number): number {\n // If b is undefined, we are clamping [0, a]\n // If b is defined, we are clamping [a, b]\n let min = b !== undefined ? a : 0;\n let max = b !== undefined ? b : a;\n\n // Handles a swapped min/max\n if (min > max) [min, max] = [max, min];\n return Math.max(min, Math.min(num, max));\n}\n\n/**\n * Calculates the interpolation factor (0-1) of a value between two points.\n * @param start - The starting value (0%).\n * @param end - The ending value (100%).\n * @param value - The value to interpolate.\n * @example\n * invLerp(0, 100, 50); // 0.5\n */\nfunction invLerp(start: number, end: number, value: number): number {\n if (start === end) return 0;\n return (value - start) / (end - start);\n}\n\n/**\n * Linearly interpolates between two values.\n * @param start - The starting value (0%).\n * @param end - The ending value (100%).\n * @param t - The interpolation factor (0 to 1).\n * @example\n * lerp(0, 100, 0.5); // 50\n * lerp(10, 20, 0.2); // 12\n */\nfunction lerp(start: number, end: number, t: number): number {\n return start + (end - start) * t;\n}\n\n/**\n * Converts seconds to milliseconds and rounds it to the nearest integer.\n * @param num The number of seconds to convert.\n */\nfunction ms(num: number): number {\n return Math.floor(num * 1000);\n}\n\n/**\n * Calculates the percentage value between two numbers.\n * @param a The numerator.\n * @param b The denominator.\n * @param round Whether to round the result to the nearest integer.\n * @example\n * percent(50, 100) --> 50 // 50%\n * percent(30, 40) --> 75 // 75%\n */\nfunction percent(a: number, b: number, round: boolean = true): number {\n const result = (a / b) * 100;\n return round ? Math.floor(result) : result;\n}\n\n/**\n * Maps a value from one range to another.\n * @param value - The value to map.\n * @param inMin - The minimum value of the input range.\n * @param inMax - The maximum value of the input range.\n * @param outMin - The minimum value of the output range.\n * @param outMax - The maximum value of the output range.\n * @example\n * // Convert mouse X position (0-1920) to a volume level (0-1)\n * const volume = remap(mouseX, 0, 1920, 0, 1);\n */\nfunction remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number {\n const t = invLerp(inMin, inMax, value);\n return lerp(outMin, outMax, t);\n}\n\n/**\n * Converts milliseconds to seconds and rounds it to the nearest integer.\n * @param num The number of milliseconds to convert.\n */\nfunction secs(num: number): number {\n return Math.floor(num / 1000);\n}\n\n/**\n * Returns the sum of an array of numbers. Negative values subtract from the total.\n * @param array The array to sum.\n * @param selector Function that selects the item's weight.\n * @param ignoreNaN If true, NaN values will not throw an error.\n */\nfunction sum<T>(array: T[], selector?: (item: T) => number): number {\n const _array = selector ? array.map(selector) : array;\n if (!_array.every(v => typeof v === \"number\")) {\n throw new TypeError(`sum: Array must only contain numbers.`);\n }\n\n return _array.reduce((a, b) => {\n return (isNaN(b) ? 0 : b) < 0 ? a - -b : a + (b || 0);\n }, 0);\n}\n\nexport { clamp, invLerp, lerp, ms, percent, remap, secs, sum };\n","/**\n * Retrieves a nested property.\n * @param obj The object to process.\n * @param path The path to retrieve (e.g., 'data.users[0].id').\n * @param defaultValue The default value to return if the property does not exist.\n */\nfunction get<T = any>(obj: Record<string, any>, path: string, defaultValue?: T): T {\n if (!obj) throw new Error(\"get: Target object is null or undefined\");\n\n // Normalize and split\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n const trace: string[] = [];\n\n for (const part of parts) {\n trace.push(part);\n\n // Check if the link in the chain exists\n if (current === null || typeof current !== \"object\" || !(part in current)) {\n // Return the default value, if provided\n if (arguments.length === 3) return defaultValue as T;\n\n // Else, throw a debug error with the trace path\n const reach = trace.join(\".\");\n throw new Error(`get: Path broken at \"${reach}\". ` + `Property \"${part}\" is missing on ${typeof current}.`);\n }\n\n current = current[part];\n }\n\n // Handle the case where the final value found is undefined\n if (current === undefined && arguments.length === 3) {\n return defaultValue as T;\n }\n\n return current as T;\n}\n\n/**\n * Checks if a nested path exists within an object.\n * @param obj The object to process.\n * @param path The path string (e.g., 'data.users[0].id').\n */\nfunction has(obj: Record<string, any>, path: string): boolean {\n if (!obj || !path) return false;\n\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]!;\n\n // If the current level isn't an object, the path can't continue\n if (current === null || typeof current !== \"object\") {\n return false;\n }\n\n // Check if the property exists at this level\n if (!(part in current)) {\n return false;\n }\n\n current = current[part];\n }\n\n return true;\n}\n\n/**\n * Sets a nested property value. Creates missing objects/arrays along the path.\n * @param obj The object to process.\n * @param path The path to set (e.g., 'data.users[0].id').\n * @param value The value to inject.\n */\nfunction set(obj: Record<string, any>, path: string, value: any): void {\n const parts = path.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\");\n let current: any = obj;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]!;\n const isLast = i === parts.length - 1;\n\n if (isLast) {\n current[part] = value;\n return;\n }\n\n // If the next part is a number, we should create an array, otherwise an object\n const nextPartIsNumber = !isNaN(Number(parts[i + 1]));\n\n if (!(part in current) || current[part] === null || typeof current[part] !== \"object\") {\n current[part] = nextPartIsNumber ? [] : {};\n }\n\n current = current[part];\n }\n}\n\n/**\n * Deep merges multiple objects.\n * @param target - The base object to merge into.\n * @param sources - One or more objects to merge.\n */\nfunction merge<T, S1>(target: T, s1: S1): T & S1;\nfunction merge<T, S1, S2>(target: T, s1: S1, s2: S2): T & S1 & S2;\nfunction merge<T, S1, S2, S3>(target: T, s1: S1, s2: S2, s3: S3): T & S1 & S2 & S3;\nfunction merge(target: any, ...sources: any[]): any;\nfunction merge(target: any, ...sources: any[]) {\n // Loop through every source object provided\n for (const source of sources) {\n if (!source) continue;\n\n Object.keys(source).forEach(key => {\n const targetValue = target[key];\n const sourceValue = source[key];\n\n if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {\n // Concat arrays\n (target as any)[key] = targetValue.concat(sourceValue);\n } else if (\n targetValue &&\n typeof targetValue === \"object\" &&\n sourceValue &&\n typeof sourceValue === \"object\" &&\n !Array.isArray(sourceValue)\n ) {\n // If both are objects, recurse\n merge(targetValue, sourceValue);\n } else {\n // Else, just set the value\n (target as any)[key] = sourceValue;\n }\n });\n }\n\n return target;\n}\n\n/**\n * Creates an object composed of the picked object properties.\n * @param obj The object to process.\n * @param keys The keys to pick from the object.\n */\nfunction pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) {\n if (key in obj) {\n result[key] = obj[key];\n }\n }\n return result;\n}\n\n/**\n * Creates an object composed of the omitted object properties.\n * @param obj The object to process.\n * @param keys The keys to omit from the object.\n */\nfunction omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n for (const key of keys) {\n delete result[key];\n }\n return result;\n}\n\nexport { get, has, set, merge, pick, omit };\n","/**\n * Escapes regex characters in the given string.\n * @param str - The string to process.\n */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/**\n * Retrieves a substring following a specific flag.\n * @param str The string to process.\n * @param flag A string or regex to look for.\n */\nfunction getFlag(str: string, flag: string | RegExp, length?: number): string | null {\n // NOTE: Using \\b ensures we don't match \"flag\" inside \"flagpole\"\n const regex = flag instanceof RegExp ? flag : new RegExp(`${escapeRegex(flag)}\\\\b`, \"g\");\n\n const match = regex.exec(str);\n if (!match) return null;\n\n const startIndex = match.index + match[0].length;\n let result = str.slice(startIndex).trimStart();\n\n // If length is provided, limit by word count\n if (length !== undefined) {\n return result.split(/\\s+/).slice(0, length).join(\" \");\n }\n\n return result || null;\n}\n\n/**\n * Checks if a string contains a specific flag.\n * @param str The string to process.\n * @param flag A string or regex to look for.\n */\nfunction hasFlag(str: string, flag: string | RegExp): boolean {\n if (flag instanceof RegExp) return flag.test(str);\n\n // NOTE: Using \\b ensures we don't match \"flag\" inside \"flagpole\"\n const pattern = new RegExp(`${escapeRegex(flag)}\\\\b`);\n return pattern.test(str);\n}\n\n/**\n * Formats a string to Title Case, optionally keeping acronyms and skipping minor words (the, and, of, etc.).\n * @param str The string to process.\n * @param smart If true, will keep acronyms and skip minor words. [default: true]\n */\nfunction toTitleCase(str: string, smart = true): string {\n const minorWords = /^(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\\.?|via)$/i;\n\n return str.replace(/\\w\\S*/g, (txt, index) => {\n // Always capitalize the first word, otherwise check if it's a minor word\n if (smart && index !== 0 && minorWords.test(txt)) {\n return txt.toLowerCase();\n }\n\n // If it's already uppercase (more than 1 letter), assume it's an acronym\n if (smart && txt.length > 1 && txt === txt.toUpperCase()) {\n return txt;\n }\n\n return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();\n });\n}\n\nexport { escapeRegex, getFlag, hasFlag, toTitleCase };\n","export interface DebouncedFunction<T extends (...args: any[]) => any> {\n (...args: Parameters<T>): void;\n /** Cancels the debounced function. */\n cancel: () => void;\n}\n\n/**\n * Only executes after 'wait' ms have passed since the last call.\n * @param fn The function to debounce.\n * @param wait The time to wait in milliseconds.\n * @param options Options for the debounce function.\n * @example\n * const search = debounce((str) => console.log(\"Searching:\", str), 500);\n * // Even if called rapidly, it only logs once 500ms after the last call.\n * search('a');\n * search('ab');\n * search('abc'); // Only 'abc' will be logged.\n * // Cancel a pending execution\n * search.cancel();\n */\nfunction debounce<T extends (...args: any[]) => any>(\n fn: T,\n wait: number,\n options: {\n /** Calls the function immediately on the leading edge. */\n immediate?: boolean;\n } = {}\n): DebouncedFunction<T> {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const leading = options.immediate ?? false;\n\n const debounced = function (this: any, ...args: Parameters<T>) {\n const callNow = leading && !timeoutId;\n if (timeoutId) clearTimeout(timeoutId);\n\n timeoutId = setTimeout(() => {\n timeoutId = undefined;\n // If we aren't in leading mode, fire the function at the end\n if (!leading) fn.apply(this, args);\n }, wait);\n\n // If leading is true and no timer was active, fire immediately\n if (callNow) fn.apply(this, args);\n } as DebouncedFunction<T>;\n\n debounced.cancel = () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n };\n\n return debounced;\n}\n\n/**\n * Executes at most once every 'limit' ms.\n * @param fn The function to throttle.\n * @param limit The time to wait in milliseconds.\n * @example\n * const handleScroll = throttle(() => console.log('Scroll position:', window.scrollY), 200);\n * // Even if the browser fires 100 scroll events per second,\n * // this function will only execute once every 200ms.\n * window.addEventListener('scroll', handleScroll);\n */\nfunction throttle<T extends (...args: any[]) => any>(fn: T, limit: number): (...args: Parameters<T>) => void {\n let inThrottle = false;\n\n return function (this: any, ...args: Parameters<T>) {\n if (!inThrottle) {\n fn.apply(this, args);\n inThrottle = true;\n setTimeout(() => (inThrottle = false), limit);\n }\n };\n}\n\nexport { debounce, throttle };\n","export type ToRecordContext<T, V> = {\n index: number;\n lastValue: V | undefined;\n newRecord: Readonly<Record<string | number, V>>;\n originalArray: ReadonlyArray<T>;\n};\n\n/**\n * Transforms an array into a object record with access to the object as it's being built.\n * @param array Array to process.\n * @param callback Function to map over the array.\n */\nfunction record<T, V>(\n array: ReadonlyArray<T>,\n callback: (item: T, context: ToRecordContext<T, V>) => { key: string | number; value: V }\n): Record<string | number, V> {\n const result: Record<string | number, V> = {};\n let lastValue: V | undefined = undefined;\n\n for (let i = 0; i < array.length; i++) {\n const { key, value } = callback(array[i]!, {\n index: i,\n lastValue,\n // NOTE: This is a reference to the object currently being built\n newRecord: result,\n originalArray: array\n });\n\n result[key] = value;\n lastValue = value;\n }\n\n return result;\n}\n\nexport { record };\n","/**\n * Pipes a value through a series of functions.\n * Each function takes the output of the previous one.\n */\nexport function Pipe<A>(value: A): A;\nexport function Pipe<A, B>(value: A, fn1: (arg: A) => B): B;\nexport function Pipe<A, B, C>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C): C;\nexport function Pipe<A, B, C, D>(value: A, fn1: (arg: A) => B, fn2: (arg: B) => C, fn3: (arg: C) => D): D;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n// prettier-ignore\nexport 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;\n\nexport function Pipe(value: any, ...fns: Function[]): any {\n return fns.reduce((acc, fn) => fn(acc), value);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\ntype StorePayload<T> = {\n value: T;\n expiry: number | null;\n};\n\nexport class Storage {\n private isNode = typeof window === \"undefined\";\n private filePath: string | null = null;\n private memoryCache = new Map<string, string>();\n\n private loadFromFile() {\n if (this.filePath && fs.existsSync(this.filePath)) {\n try {\n const data = JSON.parse(fs.readFileSync(this.filePath, \"utf-8\"));\n Object.entries(data).forEach(([k, v]) => this.memoryCache.set(k, JSON.stringify(v)));\n } catch (err) {\n console.error(`Store: Failed to load file '${this.filePath}'`, err);\n }\n }\n }\n\n private persist() {\n if (this.isNode && this.filePath) {\n const out: Record<string, any> = {};\n this.memoryCache.forEach((v, k) => (out[k] = JSON.parse(v)));\n fs.writeFileSync(this.filePath, JSON.stringify(out, null, 2));\n }\n }\n\n /**\n * A lightweight, high-performant persistent storage system.\n * Uses JSON files in Node.js, localStorage in the browser.\n * @param fileName Only used in Node.js to create a persistent .json file.\n * @param directory The directory for the file. Defaults to current working directory.\n */\n constructor(fileName?: string, directory: string = process.cwd()) {\n if (this.isNode && fileName) {\n this.filePath = path.join(directory, fileName.endsWith(\".json\") ? fileName : `${fileName}.json`);\n this.loadFromFile();\n }\n }\n\n has(key: string): boolean {\n if (!this.isNode && window.localStorage) {\n return localStorage.getItem(key) !== null;\n }\n return this.memoryCache.has(key);\n }\n\n get<T>(key: string): T | null {\n let raw: string | null = null;\n\n if (!this.isNode && window.localStorage) {\n raw = localStorage.getItem(key);\n } else {\n raw = this.memoryCache.get(key) || null;\n }\n\n if (!raw) return null;\n\n const payload: StorePayload<T> = JSON.parse(raw);\n if (payload.expiry && Date.now() > payload.expiry) {\n this.remove(key);\n this.persist();\n return null;\n }\n return payload.value;\n }\n\n set<T>(key: string, value: T, ttl?: number): void {\n const payload: StorePayload<T> = {\n value,\n expiry: ttl ? Date.now() + ttl : null\n };\n const serialized = JSON.stringify(payload);\n\n if (!this.isNode && window.localStorage) {\n localStorage.setItem(key, serialized);\n } else {\n this.memoryCache.set(key, serialized);\n this.persist();\n }\n }\n\n remove(key: string): void {\n if (!this.isNode && window.localStorage) {\n localStorage.removeItem(key);\n } else {\n this.memoryCache.delete(key);\n this.persist();\n }\n }\n\n clear(): void {\n if (!this.isNode && window.localStorage) {\n localStorage.clear();\n } else {\n this.memoryCache.clear();\n this.persist();\n }\n }\n}\n","export class Cache<T> {\n private cache = new Map<string | number, { value: T; expiresAt: number | null }>();\n private interval: any;\n\n /**\n * A lightweight, high-performant in-memory cache.\n * Uses Map for O(1) lookups and an optional cleanup interval.\n * @param cleanupMs The interval in milliseconds to run the cleanup function. [default: 60000 (1 minute)]\n */\n constructor(cleanupMs: number = 60_000) {\n // Only run cleanup if the interval is positive\n if (cleanupMs > 0) {\n this.interval = setInterval(() => this.cleanup(), cleanupMs);\n // In Node.js, allow the process to exit even if this interval is running\n if (this.interval.unref) this.interval.unref();\n }\n }\n\n set(key: string | number, value: T, ttlMs?: number): void {\n this.cache.set(key, {\n value,\n expiresAt: ttlMs ? Date.now() + ttlMs : null\n });\n }\n\n get(key: string | number): T | null {\n const data = this.cache.get(key);\n if (!data) return null;\n\n if (data.expiresAt && Date.now() > data.expiresAt) {\n // Passive cleanup\n this.cache.delete(key);\n return null;\n }\n return data.value;\n }\n\n private cleanup(): void {\n if (this.cache.size === 0) return;\n\n const now = Date.now();\n let keysProcessed = 0;\n const maxKeysToScan = 20; // Limit per cycle to avoid CPU spikes\n\n // Iterate through the map\n for (const [key, data] of this.cache) {\n if (data.expiresAt && now > data.expiresAt) {\n this.cache.delete(key);\n }\n\n keysProcessed++;\n if (keysProcessed >= maxKeysToScan) break;\n }\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n","import EventEmitter from \"node:events\";\nimport { TypedEmitter } from \"./types\";\n\nexport type LoopState = \"running\" | \"paused\" | \"stopped\";\n\nexport interface LoopEvents<T> {\n start: [];\n tick: [result: T];\n pause: [{ remaining: number }];\n resume: [];\n stop: [];\n error: [error: any];\n}\n\nconst TypedEmitterBase = EventEmitter as { new <T>(): TypedEmitter<LoopEvents<T>> };\n\nexport class Loop<T = any> extends TypedEmitterBase<T> {\n private _state: LoopState = \"stopped\";\n private timeoutId: any = null;\n private delay: number;\n private fn: (loop: Loop<T>) => Promise<T> | T;\n\n private startTime: number = 0;\n private remaining: number = 0;\n\n private async run() {\n const currentState: LoopState = this._state;\n\n if (currentState === \"stopped\" || currentState === \"paused\") return;\n\n try {\n const result = await this.fn(this);\n this.emit(\"tick\", result);\n } catch (err) {\n this.emit(\"error\", err);\n }\n\n // Re-check state after the async function finishes\n if (this._state === \"running\") {\n this.startTime = Date.now();\n this.remaining = 0;\n this.clearTimer();\n this.timeoutId = setTimeout(() => this.run(), this.delay);\n }\n }\n\n private clearTimer() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n\n /**\n * Creates an interval. If the function is async, it will wait for it to complete before scheduling the next run.\n * @param fn The function to run.\n * @param delay The delay between runs in milliseconds.\n * @param immediate Whether to start the loop immediately. [default: true]\n */\n constructor(fn: (loop: Loop<T>) => Promise<T> | T, delay: number, immediate = true) {\n super();\n this.fn = fn;\n this.delay = delay;\n if (immediate) this.start();\n }\n\n get state(): LoopState {\n return this._state;\n }\n\n /** Starts the loop. */\n start() {\n if (this._state !== \"stopped\") return;\n this._state = \"running\";\n this.emit(\"start\");\n this.run();\n }\n\n /** Resumes a paused loop. */\n resume() {\n if (this._state !== \"paused\") return;\n this._state = \"running\";\n this.emit(\"resume\");\n if (this.remaining <= 0) {\n this.run();\n } else {\n this.timeoutId = setTimeout(() => this.run(), this.remaining);\n }\n }\n\n /** Stops the loop. */\n stop() {\n const wasRunning = this._state !== \"stopped\";\n this._state = \"stopped\";\n this.remaining = 0;\n this.clearTimer();\n if (wasRunning) this.emit(\"stop\");\n }\n\n /** Pauses the execution. */\n pause() {\n if (this._state !== \"running\") return;\n this._state = \"paused\";\n const elapsed = Date.now() - this.startTime;\n this.remaining = Math.max(0, this.delay - elapsed);\n this.emit(\"pause\", { remaining: this.remaining });\n this.clearTimer();\n }\n\n /**\n * Sets the delay between runs\n * @param ms The new delay in milliseconds.\n */\n setDelay(ms: number) {\n this.delay = ms;\n }\n\n /** Manually trigger the function once without affecting the loop. */\n async execute() {\n await this.fn(this);\n }\n}\n","import * as arr from \"./arr\";\nimport * as async from \"./async\";\nimport * as fn from \"./fn\";\nimport * as date from \"./date\";\nimport * as format from \"./format\";\nimport * as fs from \"./fs\";\nimport * as is from \"./is\";\nimport * as math from \"./math\";\nimport * as obj from \"./obj\";\nimport * as rnd from \"./rnd\";\nimport * as str from \"./str\";\nimport * as timing from \"./timing\";\nimport * as to from \"./to\";\nimport { Pipe } from \"./Pipe\";\nimport { Storage } from \"./Storage\";\nimport { Cache } from \"./Cache\";\nimport { Loop } from \"./Loop\";\n\nconst qznt = {\n arr,\n async,\n fn,\n date,\n format,\n fs,\n is,\n math,\n obj,\n timing,\n rnd,\n str,\n to,\n Pipe,\n Storage,\n Cache,\n Loop\n};\n\nexport const $ = qznt;\nexport default qznt;\n\nexport * from \"./arr\";\nexport * from \"./async\";\nexport * from \"./fn\";\nexport * from \"./date\";\nexport * from \"./format\";\nexport * from \"./fs\";\nexport * from \"./is\";\nexport * from \"./math\";\nexport * from \"./obj\";\nexport * from \"./rnd\";\nexport * from \"./str\";\nexport * from \"./timing\";\nexport * from \"./to\";\nexport * from \"./types\";\nexport { Pipe } from \"./Pipe\";\nexport { Storage } from \"./Storage\";\nexport { C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WAAW,UAAW;AAC/B,SAAK,SAAS;AACd,SAAK,KAAK,OAAO;AACjB,SAAK,IAAI;AAAA,EACb;AAAA;AAAA,EAGA,SAAS;AACL,QAAI,KAAK,WAAW,SAAU;AAC9B,SAAK,SAAS;AACd,SAAK,KAAK,QAAQ;AAClB,QAAI,KAAK,aAAa,GAAG;AACrB,WAAK,IAAI;AAAA,IACb,OAAO;AACH,WAAK,YAAY,WAAW,MAAM,KAAK,IAAI,GAAG,KAAK,SAAS;AAAA,IAChE;AAAA,EACJ;AAAA;AAAA,EAGA,OAAO;AACH,UAAM,aAAa,KAAK,WAAW;AACnC,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,SAAK,WAAW;AAChB,QAAI,WAAY,MAAK,KAAK,MAAM;AAAA,EACpC;AAAA;AAAA,EAGA,QAAQ;AACJ,QAAI,KAAK,WAAW,UAAW;AAC/B,SAAK,SAAS;AACd,UAAM,UAAU,KAAK,IAAI,IAAI,KAAK;AAClC,SAAK,YAAY,KAAK,IAAI,GAAG,KAAK,QAAQ,OAAO;AACjD,SAAK,KAAK,SAAS,EAAE,WAAW,KAAK,UAAU,CAAC;AAChD,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAASC,KAAY;AACjB,SAAK,QAAQA;AAAA,EACjB;AAAA;AAAA,EAGA,MAAM,UAAU;AACZ,UAAM,KAAK,GAAG,IAAI;AAAA,EACtB;AACJ;;;ACvGA,IAAM,OAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEO,IAAM,IAAI;AACjB,IAAO,gBAAQ;","names":["percent","index","seed","ms","ms","str","path","today","path","str","index","wait","ms"]}
|
package/dist/metafile-cjs.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/rnd.ts":{"bytes":8724,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/arr.ts":{"bytes":7788,"imports":[{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/async.ts":{"bytes":884,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/fn.ts":{"bytes":2386,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/date.ts":{"bytes":4165,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/format.ts":{"bytes":2988,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/fs.ts":{"bytes":1440,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/is.ts":{"bytes":2192,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/math.ts":{"bytes":3589,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/obj.ts":{"bytes":5269,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/str.ts":{"bytes":2325,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/timing.ts":{"bytes":2544,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/to.ts":{"bytes":1042,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Pipe.ts":{"bytes":2043,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Storage.ts":{"bytes":3218,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Cache.ts":{"bytes":1823,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Loop.ts":{"bytes":3384,"imports":[{"path":"events","kind":"import-statement","external":true},{"path":"./types","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":564,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1227,"imports":[{"path":"src/arr.ts","kind":"import-statement","original":"./arr"},{"path":"src/async.ts","kind":"import-statement","original":"./async"},{"path":"src/fn.ts","kind":"import-statement","original":"./fn"},{"path":"src/date.ts","kind":"import-statement","original":"./date"},{"path":"src/format.ts","kind":"import-statement","original":"./format"},{"path":"src/fs.ts","kind":"import-statement","original":"./fs"},{"path":"src/is.ts","kind":"import-statement","original":"./is"},{"path":"src/math.ts","kind":"import-statement","original":"./math"},{"path":"src/obj.ts","kind":"import-statement","original":"./obj"},{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"src/str.ts","kind":"import-statement","original":"./str"},{"path":"src/timing.ts","kind":"import-statement","original":"./timing"},{"path":"src/to.ts","kind":"import-statement","original":"./to"},{"path":"src/Pipe.ts","kind":"import-statement","original":"./Pipe"},{"path":"src/Storage.ts","kind":"import-statement","original":"./Storage"},{"path":"src/Cache.ts","kind":"import-statement","original":"./Cache"},{"path":"src/Loop.ts","kind":"import-statement","original":"./Loop"},{"path":"src/arr.ts","kind":"import-statement","original":"./arr"},{"path":"src/async.ts","kind":"import-statement","original":"./async"},{"path":"src/fn.ts","kind":"import-statement","original":"./fn"},{"path":"src/date.ts","kind":"import-statement","original":"./date"},{"path":"src/format.ts","kind":"import-statement","original":"./format"},{"path":"src/fs.ts","kind":"import-statement","original":"./fs"},{"path":"src/is.ts","kind":"import-statement","original":"./is"},{"path":"src/math.ts","kind":"import-statement","original":"./math"},{"path":"src/obj.ts","kind":"import-statement","original":"./obj"},{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"src/str.ts","kind":"import-statement","original":"./str"},{"path":"src/timing.ts","kind":"import-statement","original":"./timing"},{"path":"src/to.ts","kind":"import-statement","original":"./to"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/Pipe.ts","kind":"import-statement","original":"./Pipe"},{"path":"src/Storage.ts","kind":"import-statement","original":"./Storage"},{"path":"src/Cache.ts","kind":"import-statement","original":"./Cache"},{"path":"src/Loop.ts","kind":"import-statement","original":"./Loop"},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":83073},"dist/index.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2010},"src/arr.ts":{"bytesInOutput":3801},"src/rnd.ts":{"bytesInOutput":4853},"src/async.ts":{"bytesInOutput":479},"src/fn.ts":{"bytesInOutput":683},"src/date.ts":{"bytesInOutput":2565},"src/format.ts":{"bytesInOutput":1462},"src/fs.ts":{"bytesInOutput":1059},"src/is.ts":{"bytesInOutput":1292},"src/math.ts":{"bytesInOutput":1261},"src/obj.ts":{"bytesInOutput":2718},"src/str.ts":{"bytesInOutput":1286},"src/timing.ts":{"bytesInOutput":874},"src/to.ts":{"bytesInOutput":479},"src/Pipe.ts":{"bytesInOutput":83},"src/Storage.ts":{"bytesInOutput":2684},"src/Cache.ts":{"bytesInOutput":1243},"src/Loop.ts":{"bytesInOutput":2505}},"bytes":33771}}}
|
package/dist/metafile-esm.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js":{"bytes":322,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"format":"esm"},"src/rnd.ts":{"bytes":8724,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/arr.ts":{"bytes":7788,"imports":[{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/async.ts":{"bytes":884,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/fn.ts":{"bytes":2386,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/date.ts":{"bytes":4165,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/format.ts":{"bytes":2988,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/fs.ts":{"bytes":1440,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/is.ts":{"bytes":2192,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/math.ts":{"bytes":3589,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/obj.ts":{"bytes":5269,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/str.ts":{"bytes":2325,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/timing.ts":{"bytes":2544,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/to.ts":{"bytes":1042,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Pipe.ts":{"bytes":2043,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Storage.ts":{"bytes":3218,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Cache.ts":{"bytes":1823,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/Loop.ts":{"bytes":3384,"imports":[{"path":"events","kind":"import-statement","external":true},{"path":"./types","kind":"import-statement","external":true},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":564,"imports":[{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1227,"imports":[{"path":"src/arr.ts","kind":"import-statement","original":"./arr"},{"path":"src/async.ts","kind":"import-statement","original":"./async"},{"path":"src/fn.ts","kind":"import-statement","original":"./fn"},{"path":"src/date.ts","kind":"import-statement","original":"./date"},{"path":"src/format.ts","kind":"import-statement","original":"./format"},{"path":"src/fs.ts","kind":"import-statement","original":"./fs"},{"path":"src/is.ts","kind":"import-statement","original":"./is"},{"path":"src/math.ts","kind":"import-statement","original":"./math"},{"path":"src/obj.ts","kind":"import-statement","original":"./obj"},{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"src/str.ts","kind":"import-statement","original":"./str"},{"path":"src/timing.ts","kind":"import-statement","original":"./timing"},{"path":"src/to.ts","kind":"import-statement","original":"./to"},{"path":"src/Pipe.ts","kind":"import-statement","original":"./Pipe"},{"path":"src/Storage.ts","kind":"import-statement","original":"./Storage"},{"path":"src/Cache.ts","kind":"import-statement","original":"./Cache"},{"path":"src/Loop.ts","kind":"import-statement","original":"./Loop"},{"path":"src/arr.ts","kind":"import-statement","original":"./arr"},{"path":"src/async.ts","kind":"import-statement","original":"./async"},{"path":"src/fn.ts","kind":"import-statement","original":"./fn"},{"path":"src/date.ts","kind":"import-statement","original":"./date"},{"path":"src/format.ts","kind":"import-statement","original":"./format"},{"path":"src/fs.ts","kind":"import-statement","original":"./fs"},{"path":"src/is.ts","kind":"import-statement","original":"./is"},{"path":"src/math.ts","kind":"import-statement","original":"./math"},{"path":"src/obj.ts","kind":"import-statement","original":"./obj"},{"path":"src/rnd.ts","kind":"import-statement","original":"./rnd"},{"path":"src/str.ts","kind":"import-statement","original":"./str"},{"path":"src/timing.ts","kind":"import-statement","original":"./timing"},{"path":"src/to.ts","kind":"import-statement","original":"./to"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/Pipe.ts","kind":"import-statement","original":"./Pipe"},{"path":"src/Storage.ts","kind":"import-statement","original":"./Storage"},{"path":"src/Cache.ts","kind":"import-statement","original":"./Cache"},{"path":"src/Loop.ts","kind":"import-statement","original":"./Loop"},{"path":"/home/xsqu1znt/Desktop/Stuff/Development/Projects/Modules/qznt/node_modules/.pnpm/tsup@8.5.1_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":82571},"dist/index.js":{"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"events","kind":"import-statement","external":true}],"exports":["$","Cache","Loop","Pipe","Storage","chance","choice","chunk","chunkAdj","clamp","cluster","compact","compactNumber","currency","debounce","default","defined","duration","empty","escapeRegex","eta","float","forceArray","get","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","string","sum","throttle","toTitleCase","today","unique","wait","weighted"],"entryPoint":"src/index.ts","inputs":{"src/arr.ts":{"bytesInOutput":3801},"src/rnd.ts":{"bytesInOutput":4853},"src/async.ts":{"bytesInOutput":479},"src/fn.ts":{"bytesInOutput":683},"src/date.ts":{"bytesInOutput":2565},"src/format.ts":{"bytesInOutput":1462},"src/fs.ts":{"bytesInOutput":883},"src/is.ts":{"bytesInOutput":1292},"src/math.ts":{"bytesInOutput":1261},"src/obj.ts":{"bytesInOutput":2718},"src/str.ts":{"bytesInOutput":1286},"src/timing.ts":{"bytesInOutput":874},"src/to.ts":{"bytesInOutput":479},"src/Pipe.ts":{"bytesInOutput":83},"src/Storage.ts":{"bytesInOutput":2550},"src/Cache.ts":{"bytesInOutput":1243},"src/Loop.ts":{"bytesInOutput":2473},"src/index.ts":{"bytesInOutput":363}},"bytes":30485}}}
|