@fuzdev/fuz_util 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args.d.ts +12 -12
- package/dist/args.js +11 -11
- package/dist/async.d.ts +12 -12
- package/dist/async.js +12 -12
- package/dist/benchmark.d.ts +24 -24
- package/dist/benchmark.js +26 -26
- package/dist/benchmark_baseline.d.ts +17 -11
- package/dist/benchmark_baseline.d.ts.map +1 -1
- package/dist/benchmark_baseline.js +26 -19
- package/dist/benchmark_format.d.ts +15 -15
- package/dist/benchmark_format.js +15 -15
- package/dist/benchmark_stats.d.ts +30 -10
- package/dist/benchmark_stats.d.ts.map +1 -1
- package/dist/benchmark_stats.js +48 -40
- package/dist/benchmark_types.d.ts +7 -7
- package/dist/bytes.d.ts +4 -4
- package/dist/bytes.js +4 -4
- package/dist/dag.d.ts +2 -2
- package/dist/dag.js +2 -2
- package/dist/deep_equal.d.ts +2 -2
- package/dist/deep_equal.js +2 -2
- package/dist/diff.d.ts +17 -17
- package/dist/diff.js +17 -17
- package/dist/dom.d.ts +4 -4
- package/dist/dom.js +4 -4
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.js +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.js +1 -1
- package/dist/hash.d.ts +6 -6
- package/dist/hash.js +8 -8
- package/dist/hash_blake3.d.ts +1 -1
- package/dist/hash_blake3.js +1 -1
- package/dist/hex.d.ts +4 -4
- package/dist/hex.js +4 -4
- package/dist/json.d.ts +2 -2
- package/dist/json.js +2 -2
- package/dist/log.d.ts +12 -12
- package/dist/log.js +11 -11
- package/dist/map.d.ts +1 -1
- package/dist/map.js +1 -1
- package/dist/object.d.ts +1 -1
- package/dist/object.js +1 -1
- package/dist/package_json.d.ts +1 -1
- package/dist/package_json.js +1 -1
- package/dist/path.d.ts +5 -5
- package/dist/path.js +5 -5
- package/dist/process.d.ts +22 -22
- package/dist/process.js +22 -22
- package/dist/random.d.ts +2 -2
- package/dist/random.js +2 -2
- package/dist/result.d.ts +6 -6
- package/dist/result.js +6 -6
- package/dist/sort.d.ts +3 -3
- package/dist/sort.js +3 -3
- package/dist/source_json.d.ts +3 -3
- package/dist/source_json.js +3 -3
- package/dist/stats.d.ts +17 -17
- package/dist/stats.js +17 -17
- package/dist/string.d.ts +6 -6
- package/dist/string.js +6 -6
- package/dist/svelte_preprocess_helpers.d.ts +42 -42
- package/dist/svelte_preprocess_helpers.js +42 -42
- package/dist/testing.d.ts +44 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +59 -0
- package/dist/time.d.ts +19 -19
- package/dist/time.js +19 -19
- package/dist/zod.d.ts +16 -16
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +24 -24
- package/package.json +6 -6
- package/src/lib/args.ts +12 -12
- package/src/lib/async.ts +12 -12
- package/src/lib/benchmark.ts +28 -28
- package/src/lib/benchmark_baseline.ts +37 -20
- package/src/lib/benchmark_format.ts +15 -15
- package/src/lib/benchmark_stats.ts +66 -44
- package/src/lib/benchmark_types.ts +7 -7
- package/src/lib/bytes.ts +4 -4
- package/src/lib/dag.ts +2 -2
- package/src/lib/deep_equal.ts +2 -2
- package/src/lib/diff.ts +17 -17
- package/src/lib/dom.ts +4 -4
- package/src/lib/fetch.ts +1 -1
- package/src/lib/git.ts +1 -1
- package/src/lib/hash.ts +8 -8
- package/src/lib/hash_blake3.ts +1 -1
- package/src/lib/hex.ts +4 -4
- package/src/lib/json.ts +2 -2
- package/src/lib/log.ts +12 -12
- package/src/lib/map.ts +1 -1
- package/src/lib/object.ts +1 -1
- package/src/lib/package_json.ts +1 -1
- package/src/lib/path.ts +5 -5
- package/src/lib/process.ts +22 -22
- package/src/lib/random.ts +2 -2
- package/src/lib/result.ts +6 -6
- package/src/lib/sort.ts +3 -3
- package/src/lib/source_json.ts +3 -3
- package/src/lib/stats.ts +17 -17
- package/src/lib/string.ts +6 -6
- package/src/lib/svelte_preprocess_helpers.ts +42 -42
- package/src/lib/testing.ts +80 -0
- package/src/lib/time.ts +19 -19
- package/src/lib/zod.ts +24 -24
package/dist/process.d.ts
CHANGED
|
@@ -138,20 +138,20 @@ export declare class ProcessRegistry {
|
|
|
138
138
|
* Spawns a process and tracks it in this registry.
|
|
139
139
|
* The process is automatically unregistered when it exits.
|
|
140
140
|
*
|
|
141
|
-
* @param command -
|
|
142
|
-
* @param args -
|
|
143
|
-
* @param options -
|
|
144
|
-
* @returns
|
|
141
|
+
* @param command - the command to run
|
|
142
|
+
* @param args - arguments to pass to the command
|
|
143
|
+
* @param options - spawn options including `signal` and `timeout_ms`
|
|
144
|
+
* @returns handle with `child` process and `closed` promise
|
|
145
145
|
*/
|
|
146
146
|
spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnProcessOptions): SpawnedProcess;
|
|
147
147
|
/**
|
|
148
148
|
* Spawns a process and captures stdout/stderr as strings.
|
|
149
149
|
* Sets `stdio: 'pipe'` automatically.
|
|
150
150
|
*
|
|
151
|
-
* @param command -
|
|
152
|
-
* @param args -
|
|
153
|
-
* @param options -
|
|
154
|
-
* @returns
|
|
151
|
+
* @param command - the command to run
|
|
152
|
+
* @param args - arguments to pass to the command
|
|
153
|
+
* @param options - spawn options
|
|
154
|
+
* @returns result with captured `stdout` and `stderr`
|
|
155
155
|
* - `null` means spawn failed (ENOENT, etc.) or stream was unavailable
|
|
156
156
|
* - `''` (empty string) means process ran but produced no output
|
|
157
157
|
* - non-empty string contains the captured output
|
|
@@ -160,16 +160,16 @@ export declare class ProcessRegistry {
|
|
|
160
160
|
/**
|
|
161
161
|
* Kills a child process and waits for it to exit.
|
|
162
162
|
*
|
|
163
|
-
* @param child -
|
|
164
|
-
* @param options -
|
|
165
|
-
* @returns
|
|
163
|
+
* @param child - the child process to kill
|
|
164
|
+
* @param options - kill options including signal and timeout
|
|
165
|
+
* @returns the spawn result after the process exits
|
|
166
166
|
*/
|
|
167
167
|
despawn(child: ChildProcess, options?: DespawnOptions): Promise<SpawnResult>;
|
|
168
168
|
/**
|
|
169
169
|
* Kills all processes in this registry.
|
|
170
170
|
*
|
|
171
|
-
* @param options -
|
|
172
|
-
* @returns
|
|
171
|
+
* @param options - kill options applied to all processes
|
|
172
|
+
* @returns array of spawn results
|
|
173
173
|
*/
|
|
174
174
|
despawn_all(options?: DespawnOptions): Promise<Array<SpawnResult>>;
|
|
175
175
|
/**
|
|
@@ -184,14 +184,14 @@ export declare class ProcessRegistry {
|
|
|
184
184
|
* graceful shutdown uses a blocking busy-wait. This may not be sufficient
|
|
185
185
|
* for processes that need significant cleanup time.
|
|
186
186
|
*
|
|
187
|
-
* @param options -
|
|
187
|
+
* @param options - configuration options
|
|
188
188
|
* @param options.to_error_label - Customize error label, return `null` for default
|
|
189
189
|
* @param options.map_error_text - Customize error text, return `''` to silence
|
|
190
190
|
* @param options.handle_error - Called after cleanup, defaults to `process.exit(1)`
|
|
191
191
|
* @param options.graceful_timeout_ms - If set, sends SIGTERM first and waits this
|
|
192
192
|
* many ms before SIGKILL. Recommended: 100-500ms. If null/undefined, uses
|
|
193
193
|
* immediate SIGKILL (default).
|
|
194
|
-
* @returns
|
|
194
|
+
* @returns cleanup function to remove the handler
|
|
195
195
|
*/
|
|
196
196
|
attach_error_handler(options?: {
|
|
197
197
|
to_error_label?: (err: Error, origin: NodeJS.UncaughtExceptionOrigin) => string | null;
|
|
@@ -256,19 +256,19 @@ export declare const despawn_all: (options?: DespawnOptions) => Promise<Array<Sp
|
|
|
256
256
|
/**
|
|
257
257
|
* Attaches an `uncaughtException` handler to the default registry.
|
|
258
258
|
*
|
|
259
|
-
* @see ProcessRegistry.attach_error_handler
|
|
259
|
+
* @see `ProcessRegistry.attach_error_handler`
|
|
260
260
|
*/
|
|
261
261
|
export declare const attach_process_error_handler: (options?: Parameters<ProcessRegistry["attach_error_handler"]>[0]) => (() => void);
|
|
262
262
|
/**
|
|
263
263
|
* Spawns a detached process that continues after parent exits.
|
|
264
264
|
*
|
|
265
|
-
* Unlike other spawn functions, this is NOT tracked in any ProcessRegistry
|
|
265
|
+
* Unlike other spawn functions, this is NOT tracked in any `ProcessRegistry`.
|
|
266
266
|
* The spawned process is meant to outlive the parent (e.g., daemon processes).
|
|
267
267
|
*
|
|
268
|
-
* @param command -
|
|
269
|
-
* @param args -
|
|
270
|
-
* @param options -
|
|
271
|
-
* @returns
|
|
268
|
+
* @param command - the command to run
|
|
269
|
+
* @param args - arguments to pass to the command
|
|
270
|
+
* @param options - spawn options (use `stdio` to redirect output to file descriptors)
|
|
271
|
+
* @returns result with pid on success, or error message on failure
|
|
272
272
|
*
|
|
273
273
|
* @example
|
|
274
274
|
* ```ts
|
|
@@ -381,7 +381,7 @@ export declare const spawn_restartable_process: (command: string, args?: Readonl
|
|
|
381
381
|
* Checks if a process with the given PID is running.
|
|
382
382
|
* Uses signal 0 which checks existence without sending a signal.
|
|
383
383
|
*
|
|
384
|
-
* @param pid -
|
|
384
|
+
* @param pid - the process ID to check (must be a positive integer)
|
|
385
385
|
* @returns `true` if the process exists (even without permission to signal it),
|
|
386
386
|
* `false` if the process doesn't exist or if pid is invalid (non-positive, non-integer, NaN, Infinity)
|
|
387
387
|
*/
|
package/dist/process.js
CHANGED
|
@@ -111,10 +111,10 @@ export class ProcessRegistry {
|
|
|
111
111
|
* Spawns a process and tracks it in this registry.
|
|
112
112
|
* The process is automatically unregistered when it exits.
|
|
113
113
|
*
|
|
114
|
-
* @param command -
|
|
115
|
-
* @param args -
|
|
116
|
-
* @param options -
|
|
117
|
-
* @returns
|
|
114
|
+
* @param command - the command to run
|
|
115
|
+
* @param args - arguments to pass to the command
|
|
116
|
+
* @param options - spawn options including `signal` and `timeout_ms`
|
|
117
|
+
* @returns handle with `child` process and `closed` promise
|
|
118
118
|
*/
|
|
119
119
|
spawn(command, args = [], options) {
|
|
120
120
|
const { signal, timeout_ms, spawn_child_process = node_spawn_child_process, ...spawn_options } = options ?? {};
|
|
@@ -141,10 +141,10 @@ export class ProcessRegistry {
|
|
|
141
141
|
* Spawns a process and captures stdout/stderr as strings.
|
|
142
142
|
* Sets `stdio: 'pipe'` automatically.
|
|
143
143
|
*
|
|
144
|
-
* @param command -
|
|
145
|
-
* @param args -
|
|
146
|
-
* @param options -
|
|
147
|
-
* @returns
|
|
144
|
+
* @param command - the command to run
|
|
145
|
+
* @param args - arguments to pass to the command
|
|
146
|
+
* @param options - spawn options
|
|
147
|
+
* @returns result with captured `stdout` and `stderr`
|
|
148
148
|
* - `null` means spawn failed (ENOENT, etc.) or stream was unavailable
|
|
149
149
|
* - `''` (empty string) means process ran but produced no output
|
|
150
150
|
* - non-empty string contains the captured output
|
|
@@ -178,9 +178,9 @@ export class ProcessRegistry {
|
|
|
178
178
|
/**
|
|
179
179
|
* Kills a child process and waits for it to exit.
|
|
180
180
|
*
|
|
181
|
-
* @param child -
|
|
182
|
-
* @param options -
|
|
183
|
-
* @returns
|
|
181
|
+
* @param child - the child process to kill
|
|
182
|
+
* @param options - kill options including signal and timeout
|
|
183
|
+
* @returns the spawn result after the process exits
|
|
184
184
|
*/
|
|
185
185
|
async despawn(child, options) {
|
|
186
186
|
const { signal = 'SIGTERM', timeout_ms } = options ?? {};
|
|
@@ -218,8 +218,8 @@ export class ProcessRegistry {
|
|
|
218
218
|
/**
|
|
219
219
|
* Kills all processes in this registry.
|
|
220
220
|
*
|
|
221
|
-
* @param options -
|
|
222
|
-
* @returns
|
|
221
|
+
* @param options - kill options applied to all processes
|
|
222
|
+
* @returns array of spawn results
|
|
223
223
|
*/
|
|
224
224
|
async despawn_all(options) {
|
|
225
225
|
return Promise.all([...this.processes].map((child) => this.despawn(child, options)));
|
|
@@ -236,14 +236,14 @@ export class ProcessRegistry {
|
|
|
236
236
|
* graceful shutdown uses a blocking busy-wait. This may not be sufficient
|
|
237
237
|
* for processes that need significant cleanup time.
|
|
238
238
|
*
|
|
239
|
-
* @param options -
|
|
239
|
+
* @param options - configuration options
|
|
240
240
|
* @param options.to_error_label - Customize error label, return `null` for default
|
|
241
241
|
* @param options.map_error_text - Customize error text, return `''` to silence
|
|
242
242
|
* @param options.handle_error - Called after cleanup, defaults to `process.exit(1)`
|
|
243
243
|
* @param options.graceful_timeout_ms - If set, sends SIGTERM first and waits this
|
|
244
244
|
* many ms before SIGKILL. Recommended: 100-500ms. If null/undefined, uses
|
|
245
245
|
* immediate SIGKILL (default).
|
|
246
|
-
* @returns
|
|
246
|
+
* @returns cleanup function to remove the handler
|
|
247
247
|
*/
|
|
248
248
|
attach_error_handler(options) {
|
|
249
249
|
if (this.#error_handler) {
|
|
@@ -348,19 +348,19 @@ export const despawn_all = (options) => process_registry_default.despawn_all(opt
|
|
|
348
348
|
/**
|
|
349
349
|
* Attaches an `uncaughtException` handler to the default registry.
|
|
350
350
|
*
|
|
351
|
-
* @see ProcessRegistry.attach_error_handler
|
|
351
|
+
* @see `ProcessRegistry.attach_error_handler`
|
|
352
352
|
*/
|
|
353
353
|
export const attach_process_error_handler = (options) => process_registry_default.attach_error_handler(options);
|
|
354
354
|
/**
|
|
355
355
|
* Spawns a detached process that continues after parent exits.
|
|
356
356
|
*
|
|
357
|
-
* Unlike other spawn functions, this is NOT tracked in any ProcessRegistry
|
|
357
|
+
* Unlike other spawn functions, this is NOT tracked in any `ProcessRegistry`.
|
|
358
358
|
* The spawned process is meant to outlive the parent (e.g., daemon processes).
|
|
359
359
|
*
|
|
360
|
-
* @param command -
|
|
361
|
-
* @param args -
|
|
362
|
-
* @param options -
|
|
363
|
-
* @returns
|
|
360
|
+
* @param command - the command to run
|
|
361
|
+
* @param args - arguments to pass to the command
|
|
362
|
+
* @param options - spawn options (use `stdio` to redirect output to file descriptors)
|
|
363
|
+
* @returns result with pid on success, or error message on failure
|
|
364
364
|
*
|
|
365
365
|
* @example
|
|
366
366
|
* ```ts
|
|
@@ -556,7 +556,7 @@ export const spawn_restartable_process = (command, args = [], options) => {
|
|
|
556
556
|
* Checks if a process with the given PID is running.
|
|
557
557
|
* Uses signal 0 which checks existence without sending a signal.
|
|
558
558
|
*
|
|
559
|
-
* @param pid -
|
|
559
|
+
* @param pid - the process ID to check (must be a positive integer)
|
|
560
560
|
* @returns `true` if the process exists (even without permission to signal it),
|
|
561
561
|
* `false` if the process doesn't exist or if pid is invalid (non-positive, non-integer, NaN, Infinity)
|
|
562
562
|
*/
|
package/dist/random.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Random helpers that accept an optional `random` parameter,
|
|
3
3
|
* defaulting to `Math.random`. Pass a seeded PRNG for reproducible results:
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - `create_random_xoshiro` — fast, high-quality numeric seeding (recommended)
|
|
6
|
+
* - `create_random_alea` — supports string and variadic seeds
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
package/dist/random.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Random helpers that accept an optional `random` parameter,
|
|
3
3
|
* defaulting to `Math.random`. Pass a seeded PRNG for reproducible results:
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - `create_random_xoshiro` — fast, high-quality numeric seeding (recommended)
|
|
6
|
+
* - `create_random_alea` — supports string and variadic seeds
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
package/dist/result.d.ts
CHANGED
|
@@ -24,9 +24,9 @@ export declare const NOT_OK: Readonly<{
|
|
|
24
24
|
* A helper that says,
|
|
25
25
|
* "hey I know this is wrapped in a `Result`, but I expect it to be `ok`,
|
|
26
26
|
* so if it's not, I understand it will throw an error that wraps the result".
|
|
27
|
-
* @param result
|
|
28
|
-
* @param message
|
|
29
|
-
* @returns
|
|
27
|
+
* @param result - some `Result` object
|
|
28
|
+
* @param message - optional custom error message
|
|
29
|
+
* @returns the wrapped value
|
|
30
30
|
*/
|
|
31
31
|
export declare const unwrap: <TValue extends {
|
|
32
32
|
value?: unknown;
|
|
@@ -54,9 +54,9 @@ export declare class ResultError extends Error {
|
|
|
54
54
|
/**
|
|
55
55
|
* A helper that does the opposite of `unwrap`, throwing if the `Result` is ok.
|
|
56
56
|
* Note that while `unwrap` returns the wrapped `value`, `unwrap_error` returns the entire result.
|
|
57
|
-
* @param result
|
|
58
|
-
* @param message
|
|
59
|
-
* @returns
|
|
57
|
+
* @param result - some `Result` object
|
|
58
|
+
* @param message - optional custom error message
|
|
59
|
+
* @returns the type-narrowed result
|
|
60
60
|
*/
|
|
61
61
|
export declare const unwrap_error: <TError extends object>(result: Result<object, TError>, message?: string) => {
|
|
62
62
|
ok: false;
|
package/dist/result.js
CHANGED
|
@@ -10,9 +10,9 @@ export const NOT_OK = Object.freeze({ ok: false });
|
|
|
10
10
|
* A helper that says,
|
|
11
11
|
* "hey I know this is wrapped in a `Result`, but I expect it to be `ok`,
|
|
12
12
|
* so if it's not, I understand it will throw an error that wraps the result".
|
|
13
|
-
* @param result
|
|
14
|
-
* @param message
|
|
15
|
-
* @returns
|
|
13
|
+
* @param result - some `Result` object
|
|
14
|
+
* @param message - optional custom error message
|
|
15
|
+
* @returns the wrapped value
|
|
16
16
|
*/
|
|
17
17
|
export const unwrap = (result, message) => {
|
|
18
18
|
if (!result.ok)
|
|
@@ -37,9 +37,9 @@ export class ResultError extends Error {
|
|
|
37
37
|
/**
|
|
38
38
|
* A helper that does the opposite of `unwrap`, throwing if the `Result` is ok.
|
|
39
39
|
* Note that while `unwrap` returns the wrapped `value`, `unwrap_error` returns the entire result.
|
|
40
|
-
* @param result
|
|
41
|
-
* @param message
|
|
42
|
-
* @returns
|
|
40
|
+
* @param result - some `Result` object
|
|
41
|
+
* @param message - optional custom error message
|
|
42
|
+
* @returns the type-narrowed result
|
|
43
43
|
*/
|
|
44
44
|
export const unwrap_error = (result, message = 'Failed to unwrap result error') => {
|
|
45
45
|
if (result.ok)
|
package/dist/sort.d.ts
CHANGED
|
@@ -30,9 +30,9 @@ export type TopologicalSortResult<T extends Sortable> = {
|
|
|
30
30
|
* Returns items ordered so that dependencies come before dependents.
|
|
31
31
|
* If a cycle is detected, returns an error with the cycle path.
|
|
32
32
|
*
|
|
33
|
-
* @param items -
|
|
34
|
-
* @param label -
|
|
35
|
-
* @returns
|
|
33
|
+
* @param items - array of items to sort
|
|
34
|
+
* @param label - label for error messages (e.g. "resource", "step")
|
|
35
|
+
* @returns sorted items or error if cycle detected
|
|
36
36
|
*/
|
|
37
37
|
export declare const topological_sort: <T extends Sortable>(items: Array<T>, label?: string) => TopologicalSortResult<T>;
|
|
38
38
|
//# sourceMappingURL=sort.d.ts.map
|
package/dist/sort.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* Returns items ordered so that dependencies come before dependents.
|
|
13
13
|
* If a cycle is detected, returns an error with the cycle path.
|
|
14
14
|
*
|
|
15
|
-
* @param items -
|
|
16
|
-
* @param label -
|
|
17
|
-
* @returns
|
|
15
|
+
* @param items - array of items to sort
|
|
16
|
+
* @param label - label for error messages (e.g. "resource", "step")
|
|
17
|
+
* @returns sorted items or error if cycle detected
|
|
18
18
|
*/
|
|
19
19
|
export const topological_sort = (items, label = 'item') => {
|
|
20
20
|
// Build id -> item map
|
package/dist/source_json.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* extracted at build time via TypeScript compiler analysis.
|
|
6
6
|
* Used for generating API documentation and enabling code search.
|
|
7
7
|
*
|
|
8
|
-
* Hierarchy: SourceJson → ModuleJson → DeclarationJson
|
|
8
|
+
* Hierarchy: `SourceJson` → `ModuleJson` → `DeclarationJson`
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -39,7 +39,7 @@ export type GenericParamInfo = z.infer<typeof GenericParamInfo>;
|
|
|
39
39
|
/**
|
|
40
40
|
* Parameter information for functions and methods.
|
|
41
41
|
*
|
|
42
|
-
* Kept distinct from ComponentPropInfo despite structural similarity.
|
|
42
|
+
* Kept distinct from `ComponentPropInfo` despite structural similarity.
|
|
43
43
|
* Function parameters form a tuple with positional semantics:
|
|
44
44
|
* calling order matters (`fn(a, b)` vs `fn(b, a)`),
|
|
45
45
|
* may include rest parameters and destructuring patterns.
|
|
@@ -55,7 +55,7 @@ export type ParameterInfo = z.infer<typeof ParameterInfo>;
|
|
|
55
55
|
/**
|
|
56
56
|
* Component prop information for Svelte components.
|
|
57
57
|
*
|
|
58
|
-
* Kept distinct from ParameterInfo despite structural similarity.
|
|
58
|
+
* Kept distinct from `ParameterInfo` despite structural similarity.
|
|
59
59
|
* Component props are named attributes with different semantics:
|
|
60
60
|
* no positional order when passing (`<Foo {a} {b} />` = `<Foo {b} {a} />`),
|
|
61
61
|
* support two-way binding via `$bindable` rune.
|
package/dist/source_json.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* extracted at build time via TypeScript compiler analysis.
|
|
6
6
|
* Used for generating API documentation and enabling code search.
|
|
7
7
|
*
|
|
8
|
-
* Hierarchy: SourceJson → ModuleJson → DeclarationJson
|
|
8
|
+
* Hierarchy: `SourceJson` → `ModuleJson` → `DeclarationJson`
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -37,7 +37,7 @@ export const GenericParamInfo = z.looseObject({
|
|
|
37
37
|
/**
|
|
38
38
|
* Parameter information for functions and methods.
|
|
39
39
|
*
|
|
40
|
-
* Kept distinct from ComponentPropInfo despite structural similarity.
|
|
40
|
+
* Kept distinct from `ComponentPropInfo` despite structural similarity.
|
|
41
41
|
* Function parameters form a tuple with positional semantics:
|
|
42
42
|
* calling order matters (`fn(a, b)` vs `fn(b, a)`),
|
|
43
43
|
* may include rest parameters and destructuring patterns.
|
|
@@ -52,7 +52,7 @@ export const ParameterInfo = z.looseObject({
|
|
|
52
52
|
/**
|
|
53
53
|
* Component prop information for Svelte components.
|
|
54
54
|
*
|
|
55
|
-
* Kept distinct from ParameterInfo despite structural similarity.
|
|
55
|
+
* Kept distinct from `ParameterInfo` despite structural similarity.
|
|
56
56
|
* Component props are named attributes with different semantics:
|
|
57
57
|
* no positional order when passing (`<Foo {a} {b} />` = `<Foo {b} {a} />`),
|
|
58
58
|
* support two-way binding via `$bindable` rune.
|
package/dist/stats.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const stats_variance: (values: Array<number>, mean?: number) => n
|
|
|
26
26
|
* Calculate a percentile of an array of numbers using linear interpolation.
|
|
27
27
|
* Uses the "R-7" method (default in R, NumPy, Excel) which interpolates between
|
|
28
28
|
* data points for more accurate percentile estimates, especially with smaller samples.
|
|
29
|
-
* @param values -
|
|
30
|
-
* @param p -
|
|
29
|
+
* @param values - array of numbers
|
|
30
|
+
* @param p - percentile (0-1, e.g., 0.95 for 95th percentile)
|
|
31
31
|
*/
|
|
32
32
|
export declare const stats_percentile: (values: Array<number>, p: number) => number;
|
|
33
33
|
/**
|
|
@@ -120,18 +120,18 @@ export interface StatsConfidenceIntervalOptions {
|
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Calculate confidence interval for the mean.
|
|
123
|
-
* @param values -
|
|
124
|
-
* @param options -
|
|
123
|
+
* @param values - array of numbers
|
|
124
|
+
* @param options - configuration options
|
|
125
125
|
* @returns [lower_bound, upper_bound]
|
|
126
126
|
*/
|
|
127
127
|
export declare const stats_confidence_interval: (values: Array<number>, options?: StatsConfidenceIntervalOptions) => [number, number];
|
|
128
128
|
/**
|
|
129
129
|
* Calculate confidence interval from summary statistics (mean, std_dev, sample_size).
|
|
130
130
|
* Useful when raw data is not available.
|
|
131
|
-
* @param mean -
|
|
132
|
-
* @param std_dev -
|
|
133
|
-
* @param sample_size -
|
|
134
|
-
* @param options -
|
|
131
|
+
* @param mean - mean of the data
|
|
132
|
+
* @param std_dev - standard deviation of the data
|
|
133
|
+
* @param sample_size - number of samples
|
|
134
|
+
* @param options - configuration options
|
|
135
135
|
* @returns [lower_bound, upper_bound]
|
|
136
136
|
*/
|
|
137
137
|
export declare const stats_confidence_interval_from_summary: (mean: number, std_dev: number, sample_size: number, options?: StatsConfidenceIntervalOptions) => [number, number];
|
|
@@ -148,12 +148,12 @@ export interface StatsWelchTTestResult {
|
|
|
148
148
|
* Calculate Welch's t-test statistic and degrees of freedom.
|
|
149
149
|
* Welch's t-test is more robust than Student's t-test when variances are unequal.
|
|
150
150
|
*
|
|
151
|
-
* @param mean1 -
|
|
152
|
-
* @param std1 -
|
|
153
|
-
* @param n1 -
|
|
154
|
-
* @param mean2 -
|
|
155
|
-
* @param std2 -
|
|
156
|
-
* @param n2 -
|
|
151
|
+
* @param mean1 - mean of first sample
|
|
152
|
+
* @param std1 - standard deviation of first sample
|
|
153
|
+
* @param n1 - size of first sample
|
|
154
|
+
* @param mean2 - mean of second sample
|
|
155
|
+
* @param std2 - standard deviation of second sample
|
|
156
|
+
* @param n2 - size of second sample
|
|
157
157
|
*/
|
|
158
158
|
export declare const stats_welch_t_test: (mean1: number, std1: number, n1: number, mean2: number, std2: number, n2: number) => StatsWelchTTestResult;
|
|
159
159
|
/**
|
|
@@ -174,9 +174,9 @@ export declare const stats_incomplete_beta: (x: number, a: number, b: number) =>
|
|
|
174
174
|
* For large df (>100), uses normal approximation.
|
|
175
175
|
* For smaller df, uses incomplete beta function.
|
|
176
176
|
*
|
|
177
|
-
* @param t -
|
|
178
|
-
* @param df -
|
|
179
|
-
* @returns
|
|
177
|
+
* @param t - absolute value of t-statistic
|
|
178
|
+
* @param df - degrees of freedom
|
|
179
|
+
* @returns two-tailed p-value
|
|
180
180
|
*/
|
|
181
181
|
export declare const stats_t_distribution_p_value: (t: number, df: number) => number;
|
|
182
182
|
//# sourceMappingURL=stats.d.ts.map
|
package/dist/stats.js
CHANGED
|
@@ -57,8 +57,8 @@ export const stats_variance = (values, mean) => {
|
|
|
57
57
|
* Calculate a percentile of an array of numbers using linear interpolation.
|
|
58
58
|
* Uses the "R-7" method (default in R, NumPy, Excel) which interpolates between
|
|
59
59
|
* data points for more accurate percentile estimates, especially with smaller samples.
|
|
60
|
-
* @param values -
|
|
61
|
-
* @param p -
|
|
60
|
+
* @param values - array of numbers
|
|
61
|
+
* @param p - percentile (0-1, e.g., 0.95 for 95th percentile)
|
|
62
62
|
*/
|
|
63
63
|
export const stats_percentile = (values, p) => {
|
|
64
64
|
if (values.length === 0)
|
|
@@ -245,8 +245,8 @@ export const stats_confidence_level_to_z_score = (level) => {
|
|
|
245
245
|
};
|
|
246
246
|
/**
|
|
247
247
|
* Calculate confidence interval for the mean.
|
|
248
|
-
* @param values -
|
|
249
|
-
* @param options -
|
|
248
|
+
* @param values - array of numbers
|
|
249
|
+
* @param options - configuration options
|
|
250
250
|
* @returns [lower_bound, upper_bound]
|
|
251
251
|
*/
|
|
252
252
|
export const stats_confidence_interval = (values, options) => {
|
|
@@ -259,10 +259,10 @@ export const stats_confidence_interval = (values, options) => {
|
|
|
259
259
|
/**
|
|
260
260
|
* Calculate confidence interval from summary statistics (mean, std_dev, sample_size).
|
|
261
261
|
* Useful when raw data is not available.
|
|
262
|
-
* @param mean -
|
|
263
|
-
* @param std_dev -
|
|
264
|
-
* @param sample_size -
|
|
265
|
-
* @param options -
|
|
262
|
+
* @param mean - mean of the data
|
|
263
|
+
* @param std_dev - standard deviation of the data
|
|
264
|
+
* @param sample_size - number of samples
|
|
265
|
+
* @param options - configuration options
|
|
266
266
|
* @returns [lower_bound, upper_bound]
|
|
267
267
|
*/
|
|
268
268
|
export const stats_confidence_interval_from_summary = (mean, std_dev, sample_size, options) => {
|
|
@@ -282,12 +282,12 @@ export const stats_confidence_interval_from_summary = (mean, std_dev, sample_siz
|
|
|
282
282
|
* Calculate Welch's t-test statistic and degrees of freedom.
|
|
283
283
|
* Welch's t-test is more robust than Student's t-test when variances are unequal.
|
|
284
284
|
*
|
|
285
|
-
* @param mean1 -
|
|
286
|
-
* @param std1 -
|
|
287
|
-
* @param n1 -
|
|
288
|
-
* @param mean2 -
|
|
289
|
-
* @param std2 -
|
|
290
|
-
* @param n2 -
|
|
285
|
+
* @param mean1 - mean of first sample
|
|
286
|
+
* @param std1 - standard deviation of first sample
|
|
287
|
+
* @param n1 - size of first sample
|
|
288
|
+
* @param mean2 - mean of second sample
|
|
289
|
+
* @param std2 - standard deviation of second sample
|
|
290
|
+
* @param n2 - size of second sample
|
|
291
291
|
*/
|
|
292
292
|
export const stats_welch_t_test = (mean1, std1, n1, mean2, std2, n2) => {
|
|
293
293
|
const var1 = std1 ** 2;
|
|
@@ -386,9 +386,9 @@ export const stats_incomplete_beta = (x, a, b) => {
|
|
|
386
386
|
* For large df (>100), uses normal approximation.
|
|
387
387
|
* For smaller df, uses incomplete beta function.
|
|
388
388
|
*
|
|
389
|
-
* @param t -
|
|
390
|
-
* @param df -
|
|
391
|
-
* @returns
|
|
389
|
+
* @param t - absolute value of t-statistic
|
|
390
|
+
* @param df - degrees of freedom
|
|
391
|
+
* @returns two-tailed p-value
|
|
392
392
|
*/
|
|
393
393
|
export const stats_t_distribution_p_value = (t, df) => {
|
|
394
394
|
// Use normal approximation for large df
|
package/dist/string.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const plural: (count: number | undefined | null, suffix?: string)
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const count_graphemes: (str: string) => number;
|
|
41
41
|
/**
|
|
42
|
-
* Strips ANSI escape sequences from a string
|
|
42
|
+
* Strips ANSI escape sequences from a string.
|
|
43
43
|
*/
|
|
44
44
|
export declare const strip_ansi: (str: string) => string;
|
|
45
45
|
/**
|
|
@@ -65,9 +65,9 @@ export declare const pad_width: (str: string, target_width: number, align?: "lef
|
|
|
65
65
|
* Calculates the Levenshtein distance between two strings.
|
|
66
66
|
* Useful for typo detection and fuzzy matching.
|
|
67
67
|
*
|
|
68
|
-
* @param a -
|
|
69
|
-
* @param b -
|
|
70
|
-
* @returns
|
|
68
|
+
* @param a - first string
|
|
69
|
+
* @param b - second string
|
|
70
|
+
* @returns the edit distance between the strings
|
|
71
71
|
*/
|
|
72
72
|
export declare const levenshtein_distance: (a: string, b: string) => number;
|
|
73
73
|
/**
|
|
@@ -82,8 +82,8 @@ export declare const escape_js_string: (value: string) => string;
|
|
|
82
82
|
*
|
|
83
83
|
* Checks for null bytes in the first 8KB of content.
|
|
84
84
|
*
|
|
85
|
-
* @param content -
|
|
86
|
-
* @returns
|
|
85
|
+
* @param content - content to check
|
|
86
|
+
* @returns true if content appears to be binary
|
|
87
87
|
*/
|
|
88
88
|
export declare const string_is_binary: (content: string) => boolean;
|
|
89
89
|
//# sourceMappingURL=string.d.ts.map
|
package/dist/string.js
CHANGED
|
@@ -81,7 +81,7 @@ export const plural = (count, suffix = 's') => count === 1 ? '' : suffix;
|
|
|
81
81
|
*/
|
|
82
82
|
export const count_graphemes = (str) => count_iterator(new Intl.Segmenter().segment(str));
|
|
83
83
|
/**
|
|
84
|
-
* Strips ANSI escape sequences from a string
|
|
84
|
+
* Strips ANSI escape sequences from a string.
|
|
85
85
|
*/
|
|
86
86
|
export const strip_ansi = (str) => str.replaceAll(/\x1B\[[0-9;]*[a-zA-Z]/g, ''); // eslint-disable-line no-control-regex
|
|
87
87
|
/**
|
|
@@ -152,9 +152,9 @@ export const pad_width = (str, target_width, align = 'left') => {
|
|
|
152
152
|
* Calculates the Levenshtein distance between two strings.
|
|
153
153
|
* Useful for typo detection and fuzzy matching.
|
|
154
154
|
*
|
|
155
|
-
* @param a -
|
|
156
|
-
* @param b -
|
|
157
|
-
* @returns
|
|
155
|
+
* @param a - first string
|
|
156
|
+
* @param b - second string
|
|
157
|
+
* @returns the edit distance between the strings
|
|
158
158
|
*/
|
|
159
159
|
export const levenshtein_distance = (a, b) => {
|
|
160
160
|
if (a.length === 0)
|
|
@@ -220,7 +220,7 @@ export const escape_js_string = (value) => value.replace(/[\\'\n\r\u2028\u2029]/
|
|
|
220
220
|
*
|
|
221
221
|
* Checks for null bytes in the first 8KB of content.
|
|
222
222
|
*
|
|
223
|
-
* @param content -
|
|
224
|
-
* @returns
|
|
223
|
+
* @param content - content to check
|
|
224
|
+
* @returns true if content appears to be binary
|
|
225
225
|
*/
|
|
226
226
|
export const string_is_binary = (content) => content.slice(0, 8192).includes('\0');
|