@the-w1zard/dx 0.0.0-stage → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.html ADDED
@@ -0,0 +1,1911 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Built-in API Extensions</title>
6
+ <style>
7
+ /* From extension vscode.github */
8
+ /*---------------------------------------------------------------------------------------------
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License. See License.txt in the project root for license information.
11
+ *--------------------------------------------------------------------------------------------*/
12
+
13
+ .vscode-dark img[src$=\#gh-light-mode-only],
14
+ .vscode-light img[src$=\#gh-dark-mode-only],
15
+ .vscode-high-contrast:not(.vscode-high-contrast-light) img[src$=\#gh-light-mode-only],
16
+ .vscode-high-contrast-light img[src$=\#gh-dark-mode-only] {
17
+ display: none;
18
+ }
19
+
20
+ </style>
21
+
22
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
23
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
24
+ <style>
25
+ body {
26
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
27
+ font-size: 14px;
28
+ line-height: 1.6;
29
+ }
30
+ </style>
31
+ <style>
32
+ .task-list-item {
33
+ list-style-type: none;
34
+ }
35
+
36
+ .task-list-item-checkbox {
37
+ margin-left: -20px;
38
+ vertical-align: middle;
39
+ pointer-events: none;
40
+ }
41
+ </style>
42
+ <style>
43
+ :root {
44
+ --color-note: #0969da;
45
+ --color-tip: #1a7f37;
46
+ --color-warning: #9a6700;
47
+ --color-severe: #bc4c00;
48
+ --color-caution: #d1242f;
49
+ --color-important: #8250df;
50
+ }
51
+
52
+ </style>
53
+ <style>
54
+ @media (prefers-color-scheme: dark) {
55
+ :root {
56
+ --color-note: #2f81f7;
57
+ --color-tip: #3fb950;
58
+ --color-warning: #d29922;
59
+ --color-severe: #db6d28;
60
+ --color-caution: #f85149;
61
+ --color-important: #a371f7;
62
+ }
63
+ }
64
+
65
+ </style>
66
+ <style>
67
+ .markdown-alert {
68
+ padding: 0.5rem 1rem;
69
+ margin-bottom: 16px;
70
+ color: inherit;
71
+ border-left: .25em solid #888;
72
+ }
73
+
74
+ .markdown-alert>:first-child {
75
+ margin-top: 0
76
+ }
77
+
78
+ .markdown-alert>:last-child {
79
+ margin-bottom: 0
80
+ }
81
+
82
+ .markdown-alert .markdown-alert-title {
83
+ display: flex;
84
+ font-weight: 500;
85
+ align-items: center;
86
+ line-height: 1
87
+ }
88
+
89
+ .markdown-alert .markdown-alert-title .octicon {
90
+ margin-right: 0.5rem;
91
+ display: inline-block;
92
+ overflow: visible !important;
93
+ vertical-align: text-bottom;
94
+ fill: currentColor;
95
+ }
96
+
97
+ .markdown-alert.markdown-alert-note {
98
+ border-left-color: var(--color-note);
99
+ }
100
+
101
+ .markdown-alert.markdown-alert-note .markdown-alert-title {
102
+ color: var(--color-note);
103
+ }
104
+
105
+ .markdown-alert.markdown-alert-important {
106
+ border-left-color: var(--color-important);
107
+ }
108
+
109
+ .markdown-alert.markdown-alert-important .markdown-alert-title {
110
+ color: var(--color-important);
111
+ }
112
+
113
+ .markdown-alert.markdown-alert-warning {
114
+ border-left-color: var(--color-warning);
115
+ }
116
+
117
+ .markdown-alert.markdown-alert-warning .markdown-alert-title {
118
+ color: var(--color-warning);
119
+ }
120
+
121
+ .markdown-alert.markdown-alert-tip {
122
+ border-left-color: var(--color-tip);
123
+ }
124
+
125
+ .markdown-alert.markdown-alert-tip .markdown-alert-title {
126
+ color: var(--color-tip);
127
+ }
128
+
129
+ .markdown-alert.markdown-alert-caution {
130
+ border-left-color: var(--color-caution);
131
+ }
132
+
133
+ .markdown-alert.markdown-alert-caution .markdown-alert-title {
134
+ color: var(--color-caution);
135
+ }
136
+
137
+ </style>
138
+
139
+ </head>
140
+ <body class="vscode-body vscode-dark">
141
+ <span id="markdown-mermaid" aria-hidden="true" data-config="{&quot;darkModeTheme&quot;:&quot;vscode&quot;,&quot;lightModeTheme&quot;:&quot;vscode&quot;,&quot;maxTextSize&quot;:50000,&quot;clickDrag&quot;:&quot;alt&quot;,&quot;showControls&quot;:&quot;onHoverOrFocus&quot;,&quot;resizable&quot;:false,&quot;maxHeight&quot;:&quot;&quot;}"></span>
142
+ <div align="left" style="position: relative;">
143
+ <img src="file:///f:\the_wizard_mods\packages\dx\icons\gandalf.png" align="right" width="30%" style="margin: -20px 0 0 20px;">
144
+ <h1>DX: <span style="font-size:18px;" >The Wizard's Arsenal</span></h1>
145
+ <p align="left"><em>The most opinionated platform... ever.</em></p>
146
+ <p align="left"><em>Trust me... I'm a fucking wizard... 🧙</em></p>
147
+ <p align="left">VSCode ext:</p>
148
+ <p align="left">
149
+ <img src="https://img.shields.io/badge/THEMES- 251-95ED27?style=flat">
150
+ <img src="https://img.shields.io/badge/SIDEBARS- 160+-95ED27?style=flat">
151
+ <img src="https://img.shields.io/badge/PRODUCT ICONS- 651-95ED27?style=flat">
152
+ <img src="https://img.shields.io/badge/FILE ICONS- 454-95ED27?style=flat">
153
+ <img src="https://img.shields.io/badge/VSCode Extentions- 82+-95ED27?style=flat">
154
+ <img src="https://img.shields.io/badge/FEATURES- SHIT TONNE-95ED27?style=flat">
155
+ </p>
156
+ <p align="left">Small but powerful repos worth checking out:</p>
157
+ <p align="left">
158
+ <p><a href="https://github.com/the-w1zard/app_store"><img src="https://img.shields.io/badge/Store / Maelstrom-000000.svg?style=flat&logo=JetBrains&logoColor=white" alt="JetBrains"></a>
159
+ <a href="https://github.com/the-w1zard/dx"><img src="https://img.shields.io/badge/UX /DX-34A853.svg?style=flat&logo=Android&logoColor=white" alt="Android"></a>
160
+ <a href="https://github.com/the-w1zard/temporal_shift"><img src="https://img.shields.io/badge/Temporal Shift-77AA99.svg?style=flat&logo=Org&logoColor=white" alt="Org"></a>
161
+ <a href="https://github.com/the-w1zard/the_cloud"><img src="https://img.shields.io/badge/The Cloud-02303A.svg?style=flat&logo=Gradle&logoColor=white" alt="Gradle"></a>
162
+ <a href="https://github.com/the-w1zard/signals"><img src="https://img.shields.io/badge/Signals-02303A.svg?style=flat&logo=Gradle&logoColor=white" alt="Gradle"></a>
163
+ <img src="https://img.shields.io/badge/Sometimes, my genius... It generates gravity.-4285F4.svg?style=flat&logo=🧙&logoColor=white" alt="Google">
164
+ <a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/Coming Soon: The Wizard Platform-7F52FF.svg?style=flat&logo=Kotlin&logoColor=white" alt="Kotlin"></a>
165
+ <a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/Coming Soon: Hadron Particle Disruptor-%23ED8B00.svg?style=flat&logo=openjdk&logoColor=white" alt="java"></a></p>
166
+ </p>
167
+ <p align="left">The goal? To remove all friction, from everything.</p>
168
+ </div>
169
+ <br clear="right">
170
+ <hr>
171
+ <span style="font-family: monospace">
172
+ <div class="markdown-alert markdown-alert-note"><p class="markdown-alert-title"><svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>TLDR</p><p></p>
173
+ <p>Take what is currently... lacking in the ux dept. and give it the updates they desperatly need.</p>
174
+ </div>
175
+ </span>
176
+ <h1 id="built-in-api-extensions">Built-in API Extensions</h1>
177
+ <p>Extensions to native JavaScript objects that improve developer experience by adding commonly needed operations while preserving the original APIs.</p>
178
+ <p>The package extends native classes and exposes their implementations through <code>globalThis</code>, allowing them to be accessed without importing each class individually.</p>
179
+ <h2 id="table-of-contents">Table of Contents</h2>
180
+ <ul>
181
+ <li><a href="#a2--array">A2 — Array</a></li>
182
+ <li><a href="#d2--date">D2 — Date</a></li>
183
+ <li><a href="#er2--error">ER2 — Error</a></li>
184
+ <li><a href="#i2--iterator">I2 — Iterator</a></li>
185
+ <li><a href="#m2--map">M2 — Map</a></li>
186
+ <li><a href="#n2--number">N2 — Number</a></li>
187
+ <li><a href="#o2--object">O2 — Object</a></li>
188
+ <li><a href="#p2--promise">P2 — Promise</a></li>
189
+ <li><a href="#usp2--urlsearchparams">USP2 — URLSearchParams</a></li>
190
+ <li><a href="#u82--array">U82 — Array</a></li>
191
+ <li><a href="#s2--string">S2 — String</a></li>
192
+ <li><a href="#ws2--weakset">WS2 — WeakSet</a></li>
193
+ <li><a href="#wm2--weakmap">WM2 — WeakMap</a></li>
194
+ <li><a href="#o2--object">O2 — Object</a></li>
195
+ <li><a href="#set2--set">SET2 — Set</a></li>
196
+ </ul>
197
+ <h2 id="global-apis">Global APIs</h2>
198
+ <table>
199
+ <thead>
200
+ <tr>
201
+ <th>Global</th>
202
+ <th>Extends</th>
203
+ <th>Implementation</th>
204
+ <th>Purpose</th>
205
+ </tr>
206
+ </thead>
207
+ <tbody>
208
+ <tr>
209
+ <td><code>N2</code></td>
210
+ <td><code>Number</code></td>
211
+ <td><code>N2I</code></td>
212
+ <td>Numeric operations, range mapping, formatting, and validation</td>
213
+ </tr>
214
+ <tr>
215
+ <td><code>M2</code></td>
216
+ <td><code>Map</code></td>
217
+ <td><code>M2I</code></td>
218
+ <td>Map access helpers, transformations, grouping, and comparison</td>
219
+ </tr>
220
+ <tr>
221
+ <td><code>I2</code></td>
222
+ <td>Iterator</td>
223
+ <td><code>I2I</code></td>
224
+ <td>Lazy iterator pipelines and collection operations</td>
225
+ </tr>
226
+ <tr>
227
+ <td><code>ER2</code></td>
228
+ <td><code>Error</code></td>
229
+ <td><code>ER2I</code></td>
230
+ <td>Error normalization, cloning, serialization, and wrapping</td>
231
+ </tr>
232
+ <tr>
233
+ <td><code>D2</code></td>
234
+ <td><code>Date</code></td>
235
+ <td><code>D2I</code></td>
236
+ <td>Date arithmetic, boundaries, comparisons, and formatting</td>
237
+ </tr>
238
+ <tr>
239
+ <td><code>A2</code></td>
240
+ <td><code>Array</code></td>
241
+ <td><code>A2I</code></td>
242
+ <td>Array manipulation, selection, grouping, and aggregation</td>
243
+ </tr>
244
+ <tr>
245
+ <td><code>SET2</code></td>
246
+ <td><code>Set</code></td>
247
+ <td><code>SET2I</code></td>
248
+ <td>Extended set operations</td>
249
+ </tr>
250
+ <tr>
251
+ <td><code>O2</code></td>
252
+ <td><code>Object</code></td>
253
+ <td><code>O2I</code></td>
254
+ <td>Extended object operations</td>
255
+ </tr>
256
+ <tr>
257
+ <td><code>WM2</code></td>
258
+ <td><code>WeakMap</code></td>
259
+ <td><code>WM2I</code></td>
260
+ <td>Extended weak-map operations</td>
261
+ </tr>
262
+ <tr>
263
+ <td><code>WS2</code></td>
264
+ <td><code>WeakSet</code></td>
265
+ <td><code>WS2I</code></td>
266
+ <td>Extended weak-set operations</td>
267
+ </tr>
268
+ <tr>
269
+ <td><code>P2</code></td>
270
+ <td><code>Promise</code></td>
271
+ <td><code>P2I</code></td>
272
+ <td>Extended promise operations</td>
273
+ </tr>
274
+ <tr>
275
+ <td><code>S2</code></td>
276
+ <td><code>String</code></td>
277
+ <td><code>S2I</code></td>
278
+ <td>Extended string operations</td>
279
+ </tr>
280
+ <tr>
281
+ <td><code>U82</code></td>
282
+ <td><code>Uint8Array</code></td>
283
+ <td><code>U82I</code></td>
284
+ <td>Extended byte-array operations</td>
285
+ </tr>
286
+ <tr>
287
+ <td><code>USP2</code></td>
288
+ <td><code>URLSearchParams</code></td>
289
+ <td><code>USP2I</code></td>
290
+ <td>Extended URL parameter operations</td>
291
+ </tr>
292
+ </tbody>
293
+ </table>
294
+ <p>The global declarations provide TypeScript access to these APIs. <code>MaybePromise</code> is also declared globally as a type alias.</p>
295
+ <h2 id="quick-reference">Quick Reference</h2>
296
+ <h2 id="a2--array"><code>A2</code> — Array</h2>
297
+ <p><code>A2I</code> extends <code>Array</code> and adds collection helpers. Methods returning arrays generally return <code>A2I</code> instances.</p>
298
+ <table>
299
+ <thead>
300
+ <tr>
301
+ <th>Method</th>
302
+ <th>Description</th>
303
+ </tr>
304
+ </thead>
305
+ <tbody>
306
+ <tr>
307
+ <td><code>first()</code> / <code>last()</code></td>
308
+ <td>Retrieve the first or last element</td>
309
+ </tr>
310
+ <tr>
311
+ <td><code>isEmpty()</code> / <code>isNotEmpty()</code></td>
312
+ <td>Check whether the array contains elements</td>
313
+ </tr>
314
+ <tr>
315
+ <td><code>clear()</code></td>
316
+ <td>Empty the array in place</td>
317
+ </tr>
318
+ <tr>
319
+ <td><code>clone()</code></td>
320
+ <td>Create a shallow copy</td>
321
+ </tr>
322
+ <tr>
323
+ <td><code>unique()</code> / <code>compact()</code></td>
324
+ <td>Remove duplicates or nullish values</td>
325
+ </tr>
326
+ <tr>
327
+ <td><code>take()</code> / <code>takeLast()</code></td>
328
+ <td>Select elements from either end</td>
329
+ </tr>
330
+ <tr>
331
+ <td><code>drop()</code> / <code>dropLast()</code></td>
332
+ <td>Remove elements from either end</td>
333
+ </tr>
334
+ <tr>
335
+ <td><code>chunk(size)</code></td>
336
+ <td>Split into fixed-size arrays</td>
337
+ </tr>
338
+ <tr>
339
+ <td><code>flatten(depth?)</code></td>
340
+ <td>Flatten nested arrays</td>
341
+ </tr>
342
+ <tr>
343
+ <td><code>flatMap(callback)</code></td>
344
+ <td>Map and flatten</td>
345
+ </tr>
346
+ <tr>
347
+ <td><code>distinctBy(callback)</code></td>
348
+ <td>Deduplicate by a computed key</td>
349
+ </tr>
350
+ <tr>
351
+ <td><code>groupBy(callback)</code></td>
352
+ <td>Group elements into a map</td>
353
+ </tr>
354
+ <tr>
355
+ <td><code>partition(callback)</code></td>
356
+ <td>Split into matching and nonmatching arrays</td>
357
+ </tr>
358
+ <tr>
359
+ <td><code>insert(index, ...items)</code></td>
360
+ <td>Insert elements in place</td>
361
+ </tr>
362
+ <tr>
363
+ <td><code>removeAt(index)</code></td>
364
+ <td>Remove and return an element</td>
365
+ </tr>
366
+ <tr>
367
+ <td><code>remove(value)</code> / <code>removeAll(value)</code></td>
368
+ <td>Remove one or all matching values</td>
369
+ </tr>
370
+ <tr>
371
+ <td><code>replaceAt(index, value)</code></td>
372
+ <td>Replace an element and return the previous value</td>
373
+ </tr>
374
+ <tr>
375
+ <td><code>move(from, to)</code> / <code>swap(first, second)</code></td>
376
+ <td>Reorder elements in place</td>
377
+ </tr>
378
+ <tr>
379
+ <td><code>sample()</code></td>
380
+ <td>Return a random element</td>
381
+ </tr>
382
+ <tr>
383
+ <td><code>shuffle()</code></td>
384
+ <td>Shuffle in place</td>
385
+ </tr>
386
+ <tr>
387
+ <td><code>countBy(callback)</code></td>
388
+ <td>Count matching elements</td>
389
+ </tr>
390
+ <tr>
391
+ <td><code>sum(callback?)</code> / <code>average(callback?)</code></td>
392
+ <td>Calculate numeric aggregates</td>
393
+ </tr>
394
+ <tr>
395
+ <td><code>min(callback?)</code> / <code>max(callback?)</code></td>
396
+ <td>Find minimum or maximum element</td>
397
+ </tr>
398
+ <tr>
399
+ <td><code>equals(array)</code></td>
400
+ <td>Compare arrays using <code>Object.is</code></td>
401
+ </tr>
402
+ <tr>
403
+ <td><code>includesAll(values)</code></td>
404
+ <td>Check whether every supplied value exists</td>
405
+ </tr>
406
+ <tr>
407
+ <td><code>intersects(values)</code></td>
408
+ <td>Check whether any supplied value exists</td>
409
+ </tr>
410
+ </tbody>
411
+ </table>
412
+ <p>Static helpers include <code>A2I.from()</code> and <code>A2I.of()</code>.</p>
413
+ <h2 id="d2--date"><code>D2</code> — Date</h2>
414
+ <table>
415
+ <thead>
416
+ <tr>
417
+ <th>Method</th>
418
+ <th>Description</th>
419
+ </tr>
420
+ </thead>
421
+ <tbody>
422
+ <tr>
423
+ <td><code>clone()</code> / <code>isValid()</code></td>
424
+ <td>Copy a date or check validity</td>
425
+ </tr>
426
+ <tr>
427
+ <td><code>month()</code> / <code>dateOfWeek()</code></td>
428
+ <td>Get one-based month or weekday index</td>
429
+ </tr>
430
+ <tr>
431
+ <td><code>dayOfYear()</code> / <code>quarter()</code></td>
432
+ <td>Get day of year or quarter</td>
433
+ </tr>
434
+ <tr>
435
+ <td><code>unix()</code> / <code>toUnix()</code></td>
436
+ <td>Get Unix timestamp in seconds</td>
437
+ </tr>
438
+ <tr>
439
+ <td><code>toUnixMs()</code></td>
440
+ <td>Get Unix timestamp in milliseconds</td>
441
+ </tr>
442
+ <tr>
443
+ <td><code>addMs()</code> / <code>addSeconds()</code> / <code>addMinutes()</code> / <code>addHours()</code></td>
444
+ <td>Add time</td>
445
+ </tr>
446
+ <tr>
447
+ <td><code>addDays()</code> / <code>addWeeks()</code> / <code>addMonths()</code> / <code>addYears()</code></td>
448
+ <td>Add calendar units</td>
449
+ </tr>
450
+ <tr>
451
+ <td><code>subDays()</code> / <code>subMonths()</code> / <code>subYears()</code></td>
452
+ <td>Subtract calendar units</td>
453
+ </tr>
454
+ <tr>
455
+ <td><code>startOfDay()</code> / <code>endOfDay()</code></td>
456
+ <td>Day boundaries</td>
457
+ </tr>
458
+ <tr>
459
+ <td><code>startOfWeek()</code> / <code>endOfWeek()</code></td>
460
+ <td>Week boundaries</td>
461
+ </tr>
462
+ <tr>
463
+ <td><code>startOfMonth()</code> / <code>endOfMonth()</code></td>
464
+ <td>Month boundaries</td>
465
+ </tr>
466
+ <tr>
467
+ <td><code>startOfQuarter()</code> / <code>endOfQuarter()</code></td>
468
+ <td>Quarter boundaries</td>
469
+ </tr>
470
+ <tr>
471
+ <td><code>startOfYear()</code> / <code>endOfYear()</code></td>
472
+ <td>Year boundaries</td>
473
+ </tr>
474
+ <tr>
475
+ <td><code>daysInMonth()</code> / <code>daysInYear()</code></td>
476
+ <td>Count days</td>
477
+ </tr>
478
+ <tr>
479
+ <td><code>isLeapYear()</code></td>
480
+ <td>Check leap year</td>
481
+ </tr>
482
+ <tr>
483
+ <td><code>isWeekend()</code> / <code>isWeekday()</code></td>
484
+ <td>Check day type</td>
485
+ </tr>
486
+ <tr>
487
+ <td><code>isBefore(date)</code> / <code>isAfter(date)</code> / <code>isEqual(date)</code></td>
488
+ <td>Compare timestamps</td>
489
+ </tr>
490
+ <tr>
491
+ <td><code>isBetween(start, end)</code></td>
492
+ <td>Check an inclusive date range</td>
493
+ </tr>
494
+ <tr>
495
+ <td><code>diffMs()</code> / <code>diffSeconds()</code> / <code>diffMinutes()</code> / <code>diffHours()</code> / <code>diffDays()</code></td>
496
+ <td>Calculate signed time differences</td>
497
+ </tr>
498
+ <tr>
499
+ <td><code>sameDay()</code> / <code>sameMonth()</code> / <code>sameYear()</code></td>
500
+ <td>Compare calendar components</td>
501
+ </tr>
502
+ <tr>
503
+ <td><code>toD2()</code></td>
504
+ <td>Return a cloned <code>D2</code></td>
505
+ </tr>
506
+ </tbody>
507
+ </table>
508
+ <p>Static helpers include <code>now()</code>, <code>fromUnix()</code>, <code>fromUnixMs()</code>, <code>fromParts()</code>, <code>today()</code>, <code>min()</code>, and <code>max()</code>.</p>
509
+ <p><code>ToLocalString(value?)</code> is also exported as a standalone formatting helper.</p>
510
+ <h2 id="er2--error"><code>ER2</code> — Error</h2>
511
+ <table>
512
+ <thead>
513
+ <tr>
514
+ <th>Method</th>
515
+ <th>Description</th>
516
+ </tr>
517
+ </thead>
518
+ <tbody>
519
+ <tr>
520
+ <td><code>clone()</code></td>
521
+ <td>Copy message, name, cause, and stack</td>
522
+ </tr>
523
+ <tr>
524
+ <td><code>toJSON()</code></td>
525
+ <td>Produce a serializable error representation</td>
526
+ </tr>
527
+ <tr>
528
+ <td><code>toString()</code></td>
529
+ <td>Format as <code>name: message</code></td>
530
+ </tr>
531
+ <tr>
532
+ <td><code>ER2.is(value)</code></td>
533
+ <td>Check whether a value is an <code>Error</code></td>
534
+ </tr>
535
+ <tr>
536
+ <td><code>ER2.isER2(value)</code></td>
537
+ <td>Check whether a value is an <code>ER2I</code></td>
538
+ </tr>
539
+ <tr>
540
+ <td><code>ER2.from(value, fallback?)</code></td>
541
+ <td>Normalize unknown values into <code>ER2I</code></td>
542
+ </tr>
543
+ <tr>
544
+ <td><code>ER2.wrap(value, message?)</code></td>
545
+ <td>Wrap an error with a cause</td>
546
+ </tr>
547
+ <tr>
548
+ <td><code>ER2.aggregate(errors, message?)</code></td>
549
+ <td>Create an <code>AggregateError</code> from multiple errors</td>
550
+ </tr>
551
+ </tbody>
552
+ </table>
553
+ <p><code>ER2I</code> accepts an optional message and standard <code>ErrorOptions</code>, including <code>cause</code>.</p>
554
+ <h2 id="i2--iterator"><code>I2</code> — Iterator</h2>
555
+ <p><code>I2I</code> wraps an iterable or iterator and provides lazy transformation pipelines.</p>
556
+ <table>
557
+ <thead>
558
+ <tr>
559
+ <th>Method</th>
560
+ <th>Description</th>
561
+ </tr>
562
+ </thead>
563
+ <tbody>
564
+ <tr>
565
+ <td><code>n()</code> / <code>r()</code> / <code>f()</code></td>
566
+ <td>Intended aliases for <code>next</code>, <code>return</code>, and <code>throw</code></td>
567
+ </tr>
568
+ <tr>
569
+ <td><code>toArray()</code></td>
570
+ <td>Consume into an array</td>
571
+ </tr>
572
+ <tr>
573
+ <td><code>first()</code> / <code>last()</code></td>
574
+ <td>Retrieve the first or last value</td>
575
+ </tr>
576
+ <tr>
577
+ <td><code>at(index)</code></td>
578
+ <td>Retrieve by position, supporting negative indices</td>
579
+ </tr>
580
+ <tr>
581
+ <td><code>peek()</code></td>
582
+ <td>Read the next value without consuming it</td>
583
+ </tr>
584
+ <tr>
585
+ <td><code>nextValue()</code></td>
586
+ <td>Return the next value</td>
587
+ </tr>
588
+ <tr>
589
+ <td><code>nextOr(value)</code> / <code>nextOrM(make)</code></td>
590
+ <td>Return the next value or a fallback</td>
591
+ </tr>
592
+ <tr>
593
+ <td><code>nextOrThrow(error?)</code></td>
594
+ <td>Throw if exhausted</td>
595
+ </tr>
596
+ <tr>
597
+ <td><code>map(fn)</code> / <code>filter(pred)</code></td>
598
+ <td>Lazy transformation and filtering</td>
599
+ </tr>
600
+ <tr>
601
+ <td><code>flatMap(fn)</code> / <code>flat()</code></td>
602
+ <td>Flatten mapped iterables</td>
603
+ </tr>
604
+ <tr>
605
+ <td><code>take(limit)</code> / <code>drop(limit)</code></td>
606
+ <td>Limit or skip values</td>
607
+ </tr>
608
+ <tr>
609
+ <td><code>unique(fn?)</code></td>
610
+ <td>Remove duplicate values or computed keys</td>
611
+ </tr>
612
+ <tr>
613
+ <td><code>chunk(size)</code></td>
614
+ <td>Emit arrays of a specified size</td>
615
+ </tr>
616
+ <tr>
617
+ <td><code>zip(other)</code></td>
618
+ <td>Pair values from two iterators</td>
619
+ </tr>
620
+ <tr>
621
+ <td><code>concat(...others)</code></td>
622
+ <td>Concatenate iterables</td>
623
+ </tr>
624
+ <tr>
625
+ <td><code>enumerate()</code></td>
626
+ <td>Emit index-value pairs</td>
627
+ </tr>
628
+ <tr>
629
+ <td><code>find(pred)</code> / <code>findIndex(pred)</code></td>
630
+ <td>Find a value or index</td>
631
+ </tr>
632
+ <tr>
633
+ <td><code>some(pred)</code> / <code>every(pred)</code></td>
634
+ <td>Predicate checks</td>
635
+ </tr>
636
+ <tr>
637
+ <td><code>reduce(fn, initial)</code> / <code>forEach(fn)</code></td>
638
+ <td>Aggregate or consume values</td>
639
+ </tr>
640
+ <tr>
641
+ <td><code>count()</code> / <code>sum(fn?)</code></td>
642
+ <td>Count or sum values</td>
643
+ </tr>
644
+ <tr>
645
+ <td><code>join(separator?)</code></td>
646
+ <td>Join values into a string</td>
647
+ </tr>
648
+ <tr>
649
+ <td><code>partition(pred)</code></td>
650
+ <td>Split into matching and nonmatching arrays</td>
651
+ </tr>
652
+ <tr>
653
+ <td><code>group(fn)</code></td>
654
+ <td>Group values into a map</td>
655
+ </tr>
656
+ <tr>
657
+ <td><code>toSet()</code> / <code>toMap(keyFn, valueFn?)</code></td>
658
+ <td>Convert to collections</td>
659
+ </tr>
660
+ <tr>
661
+ <td><code>isEmpty()</code></td>
662
+ <td>Check whether another value is available</td>
663
+ </tr>
664
+ <tr>
665
+ <td><code>exhaust()</code></td>
666
+ <td>Consume the remaining iterator</td>
667
+ </tr>
668
+ <tr>
669
+ <td><code>clone()</code></td>
670
+ <td>Create an iterator over a materialized copy</td>
671
+ </tr>
672
+ </tbody>
673
+ </table>
674
+ <h2 id="m2--map"><code>M2</code> — Map</h2>
675
+ <p><code>M2I</code> extends <code>Map</code> and retains the standard <code>Map</code> API.</p>
676
+ <table>
677
+ <thead>
678
+ <tr>
679
+ <th>Method</th>
680
+ <th>Description</th>
681
+ </tr>
682
+ </thead>
683
+ <tbody>
684
+ <tr>
685
+ <td><code>g(key)</code> / <code>h(key)</code> / <code>d(key)</code></td>
686
+ <td>Aliases for <code>get</code>, <code>has</code>, and <code>delete</code></td>
687
+ </tr>
688
+ <tr>
689
+ <td><code>s(key, value)</code></td>
690
+ <td>Set a value; evaluates function arguments as factories</td>
691
+ </tr>
692
+ <tr>
693
+ <td><code>swap(key, value)</code></td>
694
+ <td>Replace a value and return the previous value</td>
695
+ </tr>
696
+ <tr>
697
+ <td><code>take(key)</code></td>
698
+ <td>Get and delete a value</td>
699
+ </tr>
700
+ <tr>
701
+ <td><code>peek(key)</code></td>
702
+ <td>Return the value or <code>false</code> if absent</td>
703
+ </tr>
704
+ <tr>
705
+ <td><code>getOrI(key, value)</code></td>
706
+ <td>Get or insert a supplied value</td>
707
+ </tr>
708
+ <tr>
709
+ <td><code>getOrM(key, make)</code></td>
710
+ <td>Get or lazily create a value</td>
711
+ </tr>
712
+ <tr>
713
+ <td><code>update(key, fn, initial)</code></td>
714
+ <td>Update using the current value or initial value</td>
715
+ </tr>
716
+ <tr>
717
+ <td><code>setIfAbsent(key, value)</code></td>
718
+ <td>Insert only when missing</td>
719
+ </tr>
720
+ <tr>
721
+ <td><code>setIfPresent(key, value)</code></td>
722
+ <td>Set only when present</td>
723
+ </tr>
724
+ <tr>
725
+ <td><code>replace(key, value)</code></td>
726
+ <td>Replace only when present</td>
727
+ </tr>
728
+ <tr>
729
+ <td><code>inc(key, by?)</code></td>
730
+ <td>Increment a numeric entry</td>
731
+ </tr>
732
+ <tr>
733
+ <td><code>touch(key)</code></td>
734
+ <td>Ensure a key exists</td>
735
+ </tr>
736
+ <tr>
737
+ <td><code>mapValues(fn)</code> / <code>mapKeys(fn)</code></td>
738
+ <td>Transform values or keys</td>
739
+ </tr>
740
+ <tr>
741
+ <td><code>filterKV(pred)</code> / <code>filterKeys(pred)</code></td>
742
+ <td>Filter in place</td>
743
+ </tr>
744
+ <tr>
745
+ <td><code>partition(pred)</code></td>
746
+ <td>Split entries into matching and nonmatching maps</td>
747
+ </tr>
748
+ <tr>
749
+ <td><code>find(pred)</code></td>
750
+ <td>Find the first matching entry</td>
751
+ </tr>
752
+ <tr>
753
+ <td><code>findKey(pred)</code> / <code>findValue(pred)</code></td>
754
+ <td>Find a matching key or value</td>
755
+ </tr>
756
+ <tr>
757
+ <td><code>some(pred)</code> / <code>every(pred)</code></td>
758
+ <td>Predicate checks</td>
759
+ </tr>
760
+ <tr>
761
+ <td><code>reduce(fn, initial)</code></td>
762
+ <td>Reduce entries</td>
763
+ </tr>
764
+ <tr>
765
+ <td><code>forEachKV(fn)</code></td>
766
+ <td>Iterate over value, key, and map</td>
767
+ </tr>
768
+ <tr>
769
+ <td><code>invert()</code></td>
770
+ <td>Reverse keys and values</td>
771
+ </tr>
772
+ <tr>
773
+ <td><code>group(fn)</code></td>
774
+ <td>Group values by computed key</td>
775
+ </tr>
776
+ <tr>
777
+ <td><code>unique(fn?)</code></td>
778
+ <td>Deduplicate by computed or original value</td>
779
+ </tr>
780
+ <tr>
781
+ <td><code>pick(keys)</code> / <code>omit(keys)</code></td>
782
+ <td>Select or exclude keys</td>
783
+ </tr>
784
+ <tr>
785
+ <td><code>merge(entries)</code></td>
786
+ <td>Merge entries into the current map</td>
787
+ </tr>
788
+ <tr>
789
+ <td><code>clearAndSet(entries)</code></td>
790
+ <td>Replace all entries</td>
791
+ </tr>
792
+ <tr>
793
+ <td><code>toObject()</code></td>
794
+ <td>Convert entries to an object</td>
795
+ </tr>
796
+ <tr>
797
+ <td><code>toArray()</code> / <code>toKeys()</code> / <code>toValues()</code></td>
798
+ <td>Convert entries, keys, or values to arrays</td>
799
+ </tr>
800
+ <tr>
801
+ <td><code>clone()</code></td>
802
+ <td>Create a shallow copy</td>
803
+ </tr>
804
+ <tr>
805
+ <td><code>equals(other)</code></td>
806
+ <td>Compare keys and values</td>
807
+ </tr>
808
+ <tr>
809
+ <td><code>fromObject(obj)</code></td>
810
+ <td>Create a map from an object</td>
811
+ </tr>
812
+ <tr>
813
+ <td><code>fromEntries(entries)</code></td>
814
+ <td>Create a map from entries</td>
815
+ </tr>
816
+ <tr>
817
+ <td><code>from(map)</code></td>
818
+ <td>Create a map from another map</td>
819
+ </tr>
820
+ </tbody>
821
+ </table>
822
+ <h2 id="n2--number"><code>N2</code> — Number</h2>
823
+ <p>Numeric helpers return <code>N2I</code> for chaining unless otherwise indicated.</p>
824
+ <table>
825
+ <thead>
826
+ <tr>
827
+ <th>Method</th>
828
+ <th>Description</th>
829
+ </tr>
830
+ </thead>
831
+ <tbody>
832
+ <tr>
833
+ <td><code>abs()</code></td>
834
+ <td>Absolute value</td>
835
+ </tr>
836
+ <tr>
837
+ <td><code>sign()</code></td>
838
+ <td>Sign of the number</td>
839
+ </tr>
840
+ <tr>
841
+ <td><code>neg()</code></td>
842
+ <td>Negate the number</td>
843
+ </tr>
844
+ <tr>
845
+ <td><code>inv()</code></td>
846
+ <td>Reciprocal</td>
847
+ </tr>
848
+ <tr>
849
+ <td><code>clamp(min, max)</code></td>
850
+ <td>Constrain to a range</td>
851
+ </tr>
852
+ <tr>
853
+ <td><code>wrap(min, max)</code></td>
854
+ <td>Wrap into a range</td>
855
+ </tr>
856
+ <tr>
857
+ <td><code>lerp(to, t)</code></td>
858
+ <td>Linear interpolation</td>
859
+ </tr>
860
+ <tr>
861
+ <td><code>map(inMin, inMax, outMin, outMax)</code></td>
862
+ <td>Map between numeric ranges</td>
863
+ </tr>
864
+ <tr>
865
+ <td><code>remap(...)</code></td>
866
+ <td>Alias for <code>map()</code></td>
867
+ </tr>
868
+ <tr>
869
+ <td><code>roundTo(precision?)</code></td>
870
+ <td>Round to decimal precision</td>
871
+ </tr>
872
+ <tr>
873
+ <td><code>floorTo(precision?)</code></td>
874
+ <td>Floor to decimal precision</td>
875
+ </tr>
876
+ <tr>
877
+ <td><code>ceilTo(precision?)</code></td>
878
+ <td>Ceiling to decimal precision</td>
879
+ </tr>
880
+ <tr>
881
+ <td><code>truncTo(precision?)</code></td>
882
+ <td>Truncate to decimal precision</td>
883
+ </tr>
884
+ <tr>
885
+ <td><code>isFinite()</code></td>
886
+ <td>Check for a finite number</td>
887
+ </tr>
888
+ <tr>
889
+ <td><code>isInteger()</code></td>
890
+ <td>Check for an integer</td>
891
+ </tr>
892
+ <tr>
893
+ <td><code>isSafeInteger()</code></td>
894
+ <td>Check for a safe integer</td>
895
+ </tr>
896
+ <tr>
897
+ <td><code>isNaN()</code></td>
898
+ <td>Check for <code>NaN</code></td>
899
+ </tr>
900
+ <tr>
901
+ <td><code>isBetween(min, max, inclusive?)</code></td>
902
+ <td>Check whether the value is in a range</td>
903
+ </tr>
904
+ <tr>
905
+ <td><code>isPositive()</code> / <code>isNegative()</code></td>
906
+ <td>Check the sign</td>
907
+ </tr>
908
+ <tr>
909
+ <td><code>isZero()</code></td>
910
+ <td>Check for zero</td>
911
+ </tr>
912
+ <tr>
913
+ <td><code>isEven()</code> / <code>isOdd()</code></td>
914
+ <td>Check integer parity</td>
915
+ </tr>
916
+ <tr>
917
+ <td><code>squared()</code> / <code>cubed()</code></td>
918
+ <td>Square or cube</td>
919
+ </tr>
920
+ <tr>
921
+ <td><code>sqrt()</code> / <code>cbrt()</code></td>
922
+ <td>Square or cube root</td>
923
+ </tr>
924
+ <tr>
925
+ <td><code>pow(exponent)</code></td>
926
+ <td>Raise to a power</td>
927
+ </tr>
928
+ <tr>
929
+ <td><code>root(degree)</code></td>
930
+ <td>Calculate a root</td>
931
+ </tr>
932
+ <tr>
933
+ <td><code>mod(divisor)</code></td>
934
+ <td>Positive modulo</td>
935
+ </tr>
936
+ <tr>
937
+ <td><code>percentOf(total)</code></td>
938
+ <td>Calculate a percentage of a total</td>
939
+ </tr>
940
+ <tr>
941
+ <td><code>percentChange(from)</code></td>
942
+ <td>Calculate percentage change</td>
943
+ </tr>
944
+ <tr>
945
+ <td><code>toRadians()</code> / <code>toDegrees()</code></td>
946
+ <td>Convert angular units</td>
947
+ </tr>
948
+ <tr>
949
+ <td><code>toOrdinal()</code></td>
950
+ <td>Format as an ordinal</td>
951
+ </tr>
952
+ <tr>
953
+ <td><code>toBytes(unit?, decimals?)</code></td>
954
+ <td>Format as a byte quantity</td>
955
+ </tr>
956
+ <tr>
957
+ <td><code>toCompact(locales?)</code></td>
958
+ <td>Compact number formatting</td>
959
+ </tr>
960
+ <tr>
961
+ <td><code>toCurrency(currency?, locales?)</code></td>
962
+ <td>Currency formatting</td>
963
+ </tr>
964
+ <tr>
965
+ <td><code>toPercent(decimals?, locales?)</code></td>
966
+ <td>Percentage formatting</td>
967
+ </tr>
968
+ <tr>
969
+ <td><code>times(fn)</code></td>
970
+ <td>Execute a callback for each integer index below the value</td>
971
+ </tr>
972
+ <tr>
973
+ <td><code>upTo(end, step?)</code></td>
974
+ <td>Generate an ascending numeric array</td>
975
+ </tr>
976
+ <tr>
977
+ <td><code>downTo(end, step?)</code></td>
978
+ <td>Generate a descending numeric array</td>
979
+ </tr>
980
+ </tbody>
981
+ </table>
982
+ <h2 id="o2--object"><code>O2</code> — Object</h2>
983
+ <p>Provides static object inspection, nested-path access, cloning, merging, selection, transformation, comparison, and update helpers.</p>
984
+ <table>
985
+ <thead>
986
+ <tr>
987
+ <th>Method</th>
988
+ <th>Description</th>
989
+ </tr>
990
+ </thead>
991
+ <tbody>
992
+ <tr>
993
+ <td><code>isEmpty(value)</code> / <code>isNotEmpty(value)</code></td>
994
+ <td>Checks own-key count</td>
995
+ </tr>
996
+ <tr>
997
+ <td><code>size(value)</code></td>
998
+ <td>Returns the number of own keys, including symbols</td>
999
+ </tr>
1000
+ <tr>
1001
+ <td><code>isPlainObject(value)</code> / <code>isObject(value)</code></td>
1002
+ <td>Checks object type</td>
1003
+ </tr>
1004
+ <tr>
1005
+ <td><code>get(value, path, fallback?)</code></td>
1006
+ <td>Reads a nested path</td>
1007
+ </tr>
1008
+ <tr>
1009
+ <td><code>getOr(value, path, fallback)</code></td>
1010
+ <td>Reads a nested path with a typed fallback</td>
1011
+ </tr>
1012
+ <tr>
1013
+ <td><code>set(value, path, next)</code></td>
1014
+ <td>Sets a nested path, creating intermediate objects</td>
1015
+ </tr>
1016
+ <tr>
1017
+ <td><code>unset(value, path)</code></td>
1018
+ <td>Deletes a nested property</td>
1019
+ </tr>
1020
+ <tr>
1021
+ <td><code>hasPath(value, path)</code></td>
1022
+ <td>Checks whether a nested path exists</td>
1023
+ </tr>
1024
+ <tr>
1025
+ <td><code>clone(value)</code></td>
1026
+ <td>Shallow-clones an object or array</td>
1027
+ </tr>
1028
+ <tr>
1029
+ <td><code>deepClone(value)</code></td>
1030
+ <td>Uses <code>structuredClone</code></td>
1031
+ </tr>
1032
+ <tr>
1033
+ <td><code>deepMerge(target, source)</code></td>
1034
+ <td>Recursively merges plain objects</td>
1035
+ </tr>
1036
+ <tr>
1037
+ <td><code>defaults(target, defaults)</code></td>
1038
+ <td>Applies defaults while retaining target values</td>
1039
+ </tr>
1040
+ <tr>
1041
+ <td><code>getOrCreate(value, key, create)</code></td>
1042
+ <td>Creates a property when absent or undefined</td>
1043
+ </tr>
1044
+ <tr>
1045
+ <td><code>pick(value, keys)</code> / <code>omit(value, keys)</code></td>
1046
+ <td>Selects or excludes properties</td>
1047
+ </tr>
1048
+ <tr>
1049
+ <td><code>pickBy(value, predicate)</code> / <code>omitBy(value, predicate)</code></td>
1050
+ <td>Selects or excludes properties by predicate</td>
1051
+ </tr>
1052
+ <tr>
1053
+ <td><code>mapKeys(value, mapper)</code></td>
1054
+ <td>Transforms property keys</td>
1055
+ </tr>
1056
+ <tr>
1057
+ <td><code>mapValues(value, mapper)</code></td>
1058
+ <td>Transforms property values</td>
1059
+ </tr>
1060
+ <tr>
1061
+ <td><code>mapEntries(value, mapper)</code></td>
1062
+ <td>Transforms key-value entries</td>
1063
+ </tr>
1064
+ <tr>
1065
+ <td><code>filter(value, predicate)</code></td>
1066
+ <td>Selects properties by predicate</td>
1067
+ </tr>
1068
+ <tr>
1069
+ <td><code>isEqual(first, second)</code></td>
1070
+ <td>Performs recursive equality checks</td>
1071
+ </tr>
1072
+ <tr>
1073
+ <td><code>isShallowEqual(first, second)</code></td>
1074
+ <td>Compares own keys and values shallowly</td>
1075
+ </tr>
1076
+ <tr>
1077
+ <td><code>hasAll(value, keys)</code> / <code>hasAny(value, keys)</code></td>
1078
+ <td>Checks required own properties</td>
1079
+ </tr>
1080
+ <tr>
1081
+ <td><code>assertKeys(value, keys)</code></td>
1082
+ <td>Throws if required own properties are missing</td>
1083
+ </tr>
1084
+ <tr>
1085
+ <td><code>with(value, key, next)</code></td>
1086
+ <td>Returns a copy with a property changed</td>
1087
+ </tr>
1088
+ <tr>
1089
+ <td><code>without(value, key)</code></td>
1090
+ <td>Returns a copy without a property</td>
1091
+ </tr>
1092
+ <tr>
1093
+ <td><code>update(value, key, updater)</code></td>
1094
+ <td>Returns a copy with an updated property</td>
1095
+ </tr>
1096
+ </tbody>
1097
+ </table>
1098
+ <p><code>O2</code> is exposed as a static utility constructor on <code>globalThis</code>.</p>
1099
+ <h2 id="p2--promise"><code>P2</code> — Promise</h2>
1100
+ <p>Extends <code>Promise&lt;T&gt;</code> with chaining helpers, recovery, timing controls, and result conversion.</p>
1101
+ <table>
1102
+ <thead>
1103
+ <tr>
1104
+ <th>Method</th>
1105
+ <th>Description</th>
1106
+ </tr>
1107
+ </thead>
1108
+ <tbody>
1109
+ <tr>
1110
+ <td><code>tap(fn)</code></td>
1111
+ <td>Runs a callback on fulfillment and preserves the value</td>
1112
+ </tr>
1113
+ <tr>
1114
+ <td><code>tapError(fn)</code></td>
1115
+ <td>Runs a callback on rejection and preserves the rejection</td>
1116
+ </tr>
1117
+ <tr>
1118
+ <td><code>recover(fn)</code></td>
1119
+ <td>Recovers from rejection</td>
1120
+ </tr>
1121
+ <tr>
1122
+ <td><code>fallback(value)</code></td>
1123
+ <td>Supplies a fallback after rejection</td>
1124
+ </tr>
1125
+ <tr>
1126
+ <td><code>timeout(ms, error?)</code></td>
1127
+ <td>Rejects if the promise does not settle before the timeout</td>
1128
+ </tr>
1129
+ <tr>
1130
+ <td><code>delay(ms)</code></td>
1131
+ <td>Delays delivery of a fulfilled value</td>
1132
+ </tr>
1133
+ <tr>
1134
+ <td><code>withDeadline(deadline, error?)</code></td>
1135
+ <td>Applies a deadline based on a timestamp</td>
1136
+ </tr>
1137
+ <tr>
1138
+ <td><code>map(fn)</code> / <code>flatMap(fn)</code></td>
1139
+ <td>Chains a transformation</td>
1140
+ </tr>
1141
+ <tr>
1142
+ <td><code>and(other)</code> / <code>zip(other)</code></td>
1143
+ <td>Combines a fulfilled value with another value or promise</td>
1144
+ </tr>
1145
+ <tr>
1146
+ <td><code>or(other)</code></td>
1147
+ <td>Uses an alternative after rejection</td>
1148
+ </tr>
1149
+ <tr>
1150
+ <td><code>unwrap()</code></td>
1151
+ <td>Returns the promise as a native <code>Promise&lt;T&gt;</code> type</td>
1152
+ </tr>
1153
+ <tr>
1154
+ <td><code>toResult()</code></td>
1155
+ <td>Converts fulfillment or rejection into an <code>{ ok, value/error }</code> result</td>
1156
+ </tr>
1157
+ <tr>
1158
+ <td><code>onResolve(fn)</code> / <code>onReject(fn)</code></td>
1159
+ <td>Registers fulfillment or rejection callbacks</td>
1160
+ </tr>
1161
+ <tr>
1162
+ <td><code>finallyDo(fn)</code></td>
1163
+ <td>Runs a final callback</td>
1164
+ </tr>
1165
+ </tbody>
1166
+ </table>
1167
+ <p>Static helpers:</p>
1168
+ <table>
1169
+ <thead>
1170
+ <tr>
1171
+ <th>Method</th>
1172
+ <th>Description</th>
1173
+ </tr>
1174
+ </thead>
1175
+ <tbody>
1176
+ <tr>
1177
+ <td><code>resolve(value?)</code> / <code>reject(reason?)</code></td>
1178
+ <td>Creates a settled promise</td>
1179
+ </tr>
1180
+ <tr>
1181
+ <td><code>all(values)</code></td>
1182
+ <td>Waits for all promises to fulfill</td>
1183
+ </tr>
1184
+ <tr>
1185
+ <td><code>allSettled(values)</code></td>
1186
+ <td>Waits for all promises to settle</td>
1187
+ </tr>
1188
+ <tr>
1189
+ <td><code>race(values)</code></td>
1190
+ <td>Settles with the first settled promise</td>
1191
+ </tr>
1192
+ <tr>
1193
+ <td><code>any(values)</code></td>
1194
+ <td>Settles with the first fulfilled promise</td>
1195
+ </tr>
1196
+ <tr>
1197
+ <td><code>retry(fn, times?, delay?)</code></td>
1198
+ <td>Retries a task after rejection</td>
1199
+ </tr>
1200
+ <tr>
1201
+ <td><code>deferred&lt;T&gt;()</code></td>
1202
+ <td>Returns a promise with external <code>resolve</code> and <code>reject</code> functions</td>
1203
+ </tr>
1204
+ <tr>
1205
+ <td><code>try(fn)</code></td>
1206
+ <td>Executes a function and converts synchronous throws into rejection</td>
1207
+ </tr>
1208
+ </tbody>
1209
+ </table>
1210
+ <p>Chained operations return <code>P2</code> instances.</p>
1211
+ <h2 id="s2--string"><code>S2</code> — String</h2>
1212
+ <p>Extends <code>String</code> with common string checks, transformations, parsing, and conversion helpers.</p>
1213
+ <table>
1214
+ <thead>
1215
+ <tr>
1216
+ <th>Method</th>
1217
+ <th>Description</th>
1218
+ </tr>
1219
+ </thead>
1220
+ <tbody>
1221
+ <tr>
1222
+ <td><code>empty()</code> / <code>notEmpty()</code></td>
1223
+ <td>Checks whether the string has characters</td>
1224
+ </tr>
1225
+ <tr>
1226
+ <td><code>blank()</code> / <code>notBlank()</code></td>
1227
+ <td>Checks whether the string is empty or whitespace-only</td>
1228
+ </tr>
1229
+ <tr>
1230
+ <td><code>equals(value)</code></td>
1231
+ <td>Checks exact equality</td>
1232
+ </tr>
1233
+ <tr>
1234
+ <td><code>equalsIgnoreCase(value)</code></td>
1235
+ <td>Checks equality without case sensitivity</td>
1236
+ </tr>
1237
+ <tr>
1238
+ <td><code>contains(value)</code></td>
1239
+ <td>Checks whether the string contains a value</td>
1240
+ </tr>
1241
+ <tr>
1242
+ <td><code>starts(value)</code> / <code>ends(value)</code></td>
1243
+ <td>Checks the beginning or end</td>
1244
+ </tr>
1245
+ <tr>
1246
+ <td><code>first()</code> / <code>last()</code></td>
1247
+ <td>Gets the first or last character</td>
1248
+ </tr>
1249
+ <tr>
1250
+ <td><code>reverse()</code></td>
1251
+ <td>Reverses the string by Unicode code point</td>
1252
+ </tr>
1253
+ <tr>
1254
+ <td><code>capitalize()</code> / <code>uncapitalize()</code></td>
1255
+ <td>Changes the first character's case</td>
1256
+ </tr>
1257
+ <tr>
1258
+ <td><code>titleCase()</code></td>
1259
+ <td>Capitalizes word initials</td>
1260
+ </tr>
1261
+ <tr>
1262
+ <td><code>camelCase()</code></td>
1263
+ <td>Converts to camel case</td>
1264
+ </tr>
1265
+ <tr>
1266
+ <td><code>kebabCase()</code></td>
1267
+ <td>Converts to kebab case</td>
1268
+ </tr>
1269
+ <tr>
1270
+ <td><code>snakeCase()</code></td>
1271
+ <td>Converts to snake case</td>
1272
+ </tr>
1273
+ <tr>
1274
+ <td><code>pascalCase()</code></td>
1275
+ <td>Converts to PascalCase</td>
1276
+ </tr>
1277
+ <tr>
1278
+ <td><code>words()</code></td>
1279
+ <td>Extracts letter-and-number sequences</td>
1280
+ </tr>
1281
+ <tr>
1282
+ <td><code>lines()</code></td>
1283
+ <td>Splits into lines</td>
1284
+ </tr>
1285
+ <tr>
1286
+ <td><code>chars()</code> / <code>toArray()</code></td>
1287
+ <td>Converts to an array of characters</td>
1288
+ </tr>
1289
+ <tr>
1290
+ <td><code>unique()</code></td>
1291
+ <td>Removes duplicate characters</td>
1292
+ </tr>
1293
+ <tr>
1294
+ <td><code>escapeRegExp()</code></td>
1295
+ <td>Escapes regular-expression special characters</td>
1296
+ </tr>
1297
+ <tr>
1298
+ <td><code>stripHtml()</code></td>
1299
+ <td>Removes HTML-like tags</td>
1300
+ </tr>
1301
+ <tr>
1302
+ <td><code>stripWhitespace()</code></td>
1303
+ <td>Removes all whitespace</td>
1304
+ </tr>
1305
+ <tr>
1306
+ <td><code>truncate(length, suffix?)</code> / <code>limit(length, suffix?)</code></td>
1307
+ <td>Limits string length</td>
1308
+ </tr>
1309
+ <tr>
1310
+ <td><code>toNumber()</code></td>
1311
+ <td>Converts to a number</td>
1312
+ </tr>
1313
+ <tr>
1314
+ <td><code>toInt(radix?)</code></td>
1315
+ <td>Parses an integer</td>
1316
+ </tr>
1317
+ <tr>
1318
+ <td><code>toFloat()</code></td>
1319
+ <td>Parses a floating-point number</td>
1320
+ </tr>
1321
+ <tr>
1322
+ <td><code>toBoolean()</code></td>
1323
+ <td>Parses <code>true</code>, <code>1</code>, <code>yes</code>, or <code>on</code> as true</td>
1324
+ </tr>
1325
+ <tr>
1326
+ <td><code>toJSON()</code></td>
1327
+ <td>Returns the JSON-serialized string</td>
1328
+ </tr>
1329
+ </tbody>
1330
+ </table>
1331
+ <p>Also inherits the native <code>String</code> API. <code>S2</code> is registered as a callable and constructible string wrapper.</p>
1332
+ <h2 id="set2--set"><code>SET2</code> — Set</h2>
1333
+ <p>Extends <code>Set&lt;T&gt;</code> with convenience accessors, set algebra, predicate operations, and conversions.</p>
1334
+ <table>
1335
+ <thead>
1336
+ <tr>
1337
+ <th>Method</th>
1338
+ <th>Description</th>
1339
+ </tr>
1340
+ </thead>
1341
+ <tbody>
1342
+ <tr>
1343
+ <td><code>s(value)</code></td>
1344
+ <td>Alias for <code>add</code></td>
1345
+ </tr>
1346
+ <tr>
1347
+ <td><code>take(value)</code></td>
1348
+ <td>Deletes and returns the value if present</td>
1349
+ </tr>
1350
+ <tr>
1351
+ <td><code>peek(value)</code></td>
1352
+ <td>Returns the value if present, otherwise <code>false</code></td>
1353
+ </tr>
1354
+ <tr>
1355
+ <td><code>toggle(value)</code></td>
1356
+ <td>Adds an absent value or deletes a present value</td>
1357
+ </tr>
1358
+ <tr>
1359
+ <td><code>first()</code> / <code>last()</code></td>
1360
+ <td>Gets the first or last iterated value</td>
1361
+ </tr>
1362
+ <tr>
1363
+ <td><code>union(other)</code></td>
1364
+ <td>Returns the union</td>
1365
+ </tr>
1366
+ <tr>
1367
+ <td><code>intersection(other)</code></td>
1368
+ <td>Returns the intersection</td>
1369
+ </tr>
1370
+ <tr>
1371
+ <td><code>difference(other)</code></td>
1372
+ <td>Returns values absent from another iterable</td>
1373
+ </tr>
1374
+ <tr>
1375
+ <td><code>symmetricDifference(other)</code></td>
1376
+ <td>Returns values exclusive to either set</td>
1377
+ </tr>
1378
+ <tr>
1379
+ <td><code>isSubsetOf(other)</code> / <code>isSupersetOf(other)</code></td>
1380
+ <td>Checks subset or superset relationships</td>
1381
+ </tr>
1382
+ <tr>
1383
+ <td><code>isDisjointFrom(other)</code></td>
1384
+ <td>Checks whether sets have no shared values</td>
1385
+ </tr>
1386
+ <tr>
1387
+ <td><code>equals(other)</code></td>
1388
+ <td>Checks set equality</td>
1389
+ </tr>
1390
+ <tr>
1391
+ <td><code>filter(fn)</code> / <code>map(fn)</code></td>
1392
+ <td>Filters or transforms values into a <code>SET2I</code></td>
1393
+ </tr>
1394
+ <tr>
1395
+ <td><code>partition(fn)</code></td>
1396
+ <td>Splits values into matching and nonmatching sets</td>
1397
+ </tr>
1398
+ <tr>
1399
+ <td><code>differenceBy(other, fn)</code></td>
1400
+ <td>Computes a difference using computed keys</td>
1401
+ </tr>
1402
+ <tr>
1403
+ <td><code>uniqueBy(fn)</code></td>
1404
+ <td>Keeps the first value for each computed key</td>
1405
+ </tr>
1406
+ <tr>
1407
+ <td><code>find(fn)</code></td>
1408
+ <td>Returns the first matching value</td>
1409
+ </tr>
1410
+ <tr>
1411
+ <td><code>every(fn)</code> / <code>some(fn)</code></td>
1412
+ <td>Tests values against a predicate</td>
1413
+ </tr>
1414
+ <tr>
1415
+ <td><code>reduce(fn, initial)</code></td>
1416
+ <td>Reduces values to an accumulated result</td>
1417
+ </tr>
1418
+ <tr>
1419
+ <td><code>addAll(values)</code></td>
1420
+ <td>Adds multiple values</td>
1421
+ </tr>
1422
+ <tr>
1423
+ <td><code>deleteAll(values)</code></td>
1424
+ <td>Deletes values and returns the deletion count</td>
1425
+ </tr>
1426
+ <tr>
1427
+ <td><code>retainAll(values)</code></td>
1428
+ <td>Keeps only values present in another iterable</td>
1429
+ </tr>
1430
+ <tr>
1431
+ <td><code>update(values)</code></td>
1432
+ <td>Adds values from another iterable</td>
1433
+ </tr>
1434
+ <tr>
1435
+ <td><code>replace(values)</code></td>
1436
+ <td>Replaces all members</td>
1437
+ </tr>
1438
+ <tr>
1439
+ <td><code>swap(a, b)</code></td>
1440
+ <td>Removes <code>a</code> and adds <code>b</code> if <code>a</code> exists</td>
1441
+ </tr>
1442
+ <tr>
1443
+ <td><code>clone()</code></td>
1444
+ <td>Creates a copy</td>
1445
+ </tr>
1446
+ <tr>
1447
+ <td><code>toArray()</code></td>
1448
+ <td>Converts to an array</td>
1449
+ </tr>
1450
+ <tr>
1451
+ <td><code>toMap(fn)</code></td>
1452
+ <td>Converts values into a map using returned key-value pairs</td>
1453
+ </tr>
1454
+ <tr>
1455
+ <td><code>toObject(fn?)</code></td>
1456
+ <td>Converts values to an object using generated or stringified keys</td>
1457
+ </tr>
1458
+ <tr>
1459
+ <td><code>toJSON()</code></td>
1460
+ <td>Returns the values as an array</td>
1461
+ </tr>
1462
+ </tbody>
1463
+ </table>
1464
+ <p>Static constructors: <code>fromArray(values)</code>, <code>fromObject(obj)</code>, <code>fromEntries(entries)</code>, and <code>from(values)</code>.</p>
1465
+ <h2 id="u82--array"><code>U82</code> — Array</h2>
1466
+ <p>Extends <code>Array&lt;T&gt;</code> with collection access, transformations, set-like operations, and in-place utilities.</p>
1467
+ <table>
1468
+ <thead>
1469
+ <tr>
1470
+ <th>Method</th>
1471
+ <th>Description</th>
1472
+ </tr>
1473
+ </thead>
1474
+ <tbody>
1475
+ <tr>
1476
+ <td><code>first()</code> / <code>second()</code> / <code>third()</code> / <code>last()</code></td>
1477
+ <td>Gets an element by position</td>
1478
+ </tr>
1479
+ <tr>
1480
+ <td><code>random()</code></td>
1481
+ <td>Gets a random element</td>
1482
+ </tr>
1483
+ <tr>
1484
+ <td><code>isEmpty()</code> / <code>isNotEmpty()</code></td>
1485
+ <td>Checks whether the array has elements</td>
1486
+ </tr>
1487
+ <tr>
1488
+ <td><code>isNotEmptyAndDefined()</code></td>
1489
+ <td>Checks for at least one non-nullish element</td>
1490
+ </tr>
1491
+ <tr>
1492
+ <td><code>clear()</code></td>
1493
+ <td>Empties the array in place</td>
1494
+ </tr>
1495
+ <tr>
1496
+ <td><code>clone()</code></td>
1497
+ <td>Creates a shallow copy</td>
1498
+ </tr>
1499
+ <tr>
1500
+ <td><code>unique()</code></td>
1501
+ <td>Removes duplicate values</td>
1502
+ </tr>
1503
+ <tr>
1504
+ <td><code>compact()</code></td>
1505
+ <td>Removes <code>null</code> and <code>undefined</code></td>
1506
+ </tr>
1507
+ <tr>
1508
+ <td><code>chunk(size)</code></td>
1509
+ <td>Splits into groups of a given size</td>
1510
+ </tr>
1511
+ <tr>
1512
+ <td><code>flatten(depth?)</code> / <code>flattenDeep()</code></td>
1513
+ <td>Flattens nested arrays</td>
1514
+ </tr>
1515
+ <tr>
1516
+ <td><code>shuffle()</code> / <code>shuffleInPlace()</code></td>
1517
+ <td>Randomizes the array in place</td>
1518
+ </tr>
1519
+ <tr>
1520
+ <td><code>sample(count?)</code> / <code>pick(count?)</code></td>
1521
+ <td>Selects random elements without replacement</td>
1522
+ </tr>
1523
+ <tr>
1524
+ <td><code>count(predicate?)</code></td>
1525
+ <td>Counts all elements or matching elements</td>
1526
+ </tr>
1527
+ <tr>
1528
+ <td><code>sum()</code> / <code>average()</code> / <code>min()</code> / <code>max()</code></td>
1529
+ <td>Numeric aggregations</td>
1530
+ </tr>
1531
+ <tr>
1532
+ <td><code>groupBy(keyFn)</code></td>
1533
+ <td>Groups elements by computed key</td>
1534
+ </tr>
1535
+ <tr>
1536
+ <td><code>keyBy(keyFn)</code> / <code>toMap(keyFn)</code></td>
1537
+ <td>Maps computed keys to elements</td>
1538
+ </tr>
1539
+ <tr>
1540
+ <td><code>partition(predicate)</code></td>
1541
+ <td>Splits elements into matching and nonmatching arrays</td>
1542
+ </tr>
1543
+ <tr>
1544
+ <td><code>difference(other)</code></td>
1545
+ <td>Returns elements not present in another iterable</td>
1546
+ </tr>
1547
+ <tr>
1548
+ <td><code>intersection(other)</code></td>
1549
+ <td>Returns elements present in another iterable</td>
1550
+ </tr>
1551
+ <tr>
1552
+ <td><code>union(other)</code></td>
1553
+ <td>Combines unique elements</td>
1554
+ </tr>
1555
+ <tr>
1556
+ <td><code>symmetricDifference(other)</code></td>
1557
+ <td>Returns elements exclusive to either collection</td>
1558
+ </tr>
1559
+ <tr>
1560
+ <td><code>take(count)</code> / <code>takeLast(count)</code></td>
1561
+ <td>Takes elements from either end</td>
1562
+ </tr>
1563
+ <tr>
1564
+ <td><code>drop(count)</code> / <code>dropLast(count)</code></td>
1565
+ <td>Removes elements from either end in the returned copy</td>
1566
+ </tr>
1567
+ <tr>
1568
+ <td><code>pluck(key)</code></td>
1569
+ <td>Extracts a property from every element</td>
1570
+ </tr>
1571
+ <tr>
1572
+ <td><code>insert(index, ...items)</code></td>
1573
+ <td>Inserts elements in place</td>
1574
+ </tr>
1575
+ <tr>
1576
+ <td><code>removeAt(index)</code></td>
1577
+ <td>Removes and returns an element</td>
1578
+ </tr>
1579
+ <tr>
1580
+ <td><code>remove(value)</code></td>
1581
+ <td>Removes the first matching element</td>
1582
+ </tr>
1583
+ <tr>
1584
+ <td><code>removeWhere(predicate)</code></td>
1585
+ <td>Removes all matching elements in place</td>
1586
+ </tr>
1587
+ <tr>
1588
+ <td><code>replace(oldValue, newValue)</code></td>
1589
+ <td>Replaces the first matching element</td>
1590
+ </tr>
1591
+ <tr>
1592
+ <td><code>move(from, to)</code></td>
1593
+ <td>Moves an element to another index</td>
1594
+ </tr>
1595
+ <tr>
1596
+ <td><code>swap(i, j)</code></td>
1597
+ <td>Swaps two positions</td>
1598
+ </tr>
1599
+ <tr>
1600
+ <td><code>toSet()</code></td>
1601
+ <td>Converts to a native <code>Set</code></td>
1602
+ </tr>
1603
+ <tr>
1604
+ <td><code>equals(other)</code></td>
1605
+ <td>Checks element-by-element equality</td>
1606
+ </tr>
1607
+ <tr>
1608
+ <td><code>startsWith(other)</code> / <code>endsWith(other)</code></td>
1609
+ <td>Checks matching elements at either end</td>
1610
+ </tr>
1611
+ <tr>
1612
+ <td><code>isSorted(compareFn?)</code></td>
1613
+ <td>Checks whether elements are sorted</td>
1614
+ </tr>
1615
+ <tr>
1616
+ <td><code>frequencies()</code></td>
1617
+ <td>Counts occurrences of each element</td>
1618
+ </tr>
1619
+ </tbody>
1620
+ </table>
1621
+ <p>Also inherits the native <code>Array</code> API. Static <code>from()</code> and <code>of()</code> return the enhanced array type.</p>
1622
+ <h2 id="usp2--urlsearchparams"><code>USP2</code> — URLSearchParams</h2>
1623
+ <p>Extends <code>URLSearchParams</code> with typed value access, serialization, merging, and convenience methods.</p>
1624
+ <table>
1625
+ <thead>
1626
+ <tr>
1627
+ <th>Method</th>
1628
+ <th>Description</th>
1629
+ </tr>
1630
+ </thead>
1631
+ <tbody>
1632
+ <tr>
1633
+ <td><code>getOr(name, fallback)</code></td>
1634
+ <td>Gets a parameter or returns a fallback</td>
1635
+ </tr>
1636
+ <tr>
1637
+ <td><code>getOrNull(name)</code></td>
1638
+ <td>Gets a parameter or returns <code>null</code></td>
1639
+ </tr>
1640
+ <tr>
1641
+ <td><code>getOrThrow(name, error?)</code></td>
1642
+ <td>Gets a parameter or throws</td>
1643
+ </tr>
1644
+ <tr>
1645
+ <td><code>getNumber(name, fallback?)</code></td>
1646
+ <td>Parses a finite number</td>
1647
+ </tr>
1648
+ <tr>
1649
+ <td><code>getInt(name, radix?)</code></td>
1650
+ <td>Parses an integer</td>
1651
+ </tr>
1652
+ <tr>
1653
+ <td><code>getFloat(name)</code></td>
1654
+ <td>Parses a floating-point number</td>
1655
+ </tr>
1656
+ <tr>
1657
+ <td><code>getBoolean(name, fallback?)</code></td>
1658
+ <td>Parses boolean-like values</td>
1659
+ </tr>
1660
+ <tr>
1661
+ <td><code>getJSON&lt;T&gt;(name)</code></td>
1662
+ <td>Parses JSON; returns <code>undefined</code> on missing or invalid JSON</td>
1663
+ </tr>
1664
+ <tr>
1665
+ <td><code>getArray(name, separator?)</code></td>
1666
+ <td>Splits a parameter into an array</td>
1667
+ </tr>
1668
+ <tr>
1669
+ <td><code>getObject&lt;T&gt;()</code></td>
1670
+ <td>Converts parameters to an object, preserving repeated values as arrays</td>
1671
+ </tr>
1672
+ <tr>
1673
+ <td><code>setNumber(name, value)</code></td>
1674
+ <td>Sets a numeric parameter</td>
1675
+ </tr>
1676
+ <tr>
1677
+ <td><code>setBoolean(name, value)</code></td>
1678
+ <td>Sets a boolean parameter</td>
1679
+ </tr>
1680
+ <tr>
1681
+ <td><code>setJSON(name, value)</code></td>
1682
+ <td>JSON-serializes a value into a parameter</td>
1683
+ </tr>
1684
+ <tr>
1685
+ <td><code>setArray(name, values, separator?)</code></td>
1686
+ <td>Joins values into a parameter</td>
1687
+ </tr>
1688
+ <tr>
1689
+ <td><code>setIfAbsent(name, value)</code></td>
1690
+ <td>Sets only if the parameter does not exist</td>
1691
+ </tr>
1692
+ <tr>
1693
+ <td><code>setIfPresent(name, value)</code></td>
1694
+ <td>Sets only if the parameter exists</td>
1695
+ </tr>
1696
+ <tr>
1697
+ <td><code>appendAll(params)</code></td>
1698
+ <td>Appends parameters from another source</td>
1699
+ </tr>
1700
+ <tr>
1701
+ <td><code>merge(params, overwrite?)</code></td>
1702
+ <td>Merges parameters, overwriting by default</td>
1703
+ </tr>
1704
+ <tr>
1705
+ <td><code>clone()</code></td>
1706
+ <td>Creates a copy</td>
1707
+ </tr>
1708
+ <tr>
1709
+ <td><code>clear()</code></td>
1710
+ <td>Removes all parameters</td>
1711
+ </tr>
1712
+ <tr>
1713
+ <td><code>isEmpty()</code> / <code>isNotEmpty()</code></td>
1714
+ <td>Checks whether parameters exist</td>
1715
+ </tr>
1716
+ <tr>
1717
+ <td><code>toObject()</code> / <code>toJSON()</code></td>
1718
+ <td>Converts parameters to an object</td>
1719
+ </tr>
1720
+ <tr>
1721
+ <td><code>toURLSearchParams()</code></td>
1722
+ <td>Returns a native <code>URLSearchParams</code> copy</td>
1723
+ </tr>
1724
+ <tr>
1725
+ <td><code>toURL(url)</code></td>
1726
+ <td>Creates a URL and appends these parameters</td>
1727
+ </tr>
1728
+ </tbody>
1729
+ </table>
1730
+ <p>Also exposes <code>size</code> and inherits the native <code>URLSearchParams</code> API.</p>
1731
+ <h2 id="wm2--weakmap"><code>WM2</code> — WeakMap</h2>
1732
+ <p>Extends <code>WeakMap&lt;K, V&gt;</code> with aliases, lazy initialization, conditional updates, and optional explicit key tracking.</p>
1733
+ <table>
1734
+ <thead>
1735
+ <tr>
1736
+ <th>Method</th>
1737
+ <th>Description</th>
1738
+ </tr>
1739
+ </thead>
1740
+ <tbody>
1741
+ <tr>
1742
+ <td><code>g</code> / <code>h</code> / <code>d</code></td>
1743
+ <td>Aliases for <code>get</code> / <code>has</code> / <code>delete</code></td>
1744
+ </tr>
1745
+ <tr>
1746
+ <td><code>s(key, value)</code></td>
1747
+ <td>Sets a value; evaluates a function argument lazily</td>
1748
+ </tr>
1749
+ <tr>
1750
+ <td><code>swap(key, value)</code></td>
1751
+ <td>Sets a value and returns the previous value</td>
1752
+ </tr>
1753
+ <tr>
1754
+ <td><code>take(key)</code> / <code>getAndDelete(key)</code></td>
1755
+ <td>Gets and deletes a value</td>
1756
+ </tr>
1757
+ <tr>
1758
+ <td><code>peek(key)</code></td>
1759
+ <td>Returns the value or <code>false</code> if absent</td>
1760
+ </tr>
1761
+ <tr>
1762
+ <td><code>getOrI(key, value)</code></td>
1763
+ <td>Gets an existing value or stores the supplied value</td>
1764
+ </tr>
1765
+ <tr>
1766
+ <td><code>getOrM(key, make)</code></td>
1767
+ <td>Gets an existing value or lazily creates and stores one</td>
1768
+ </tr>
1769
+ <tr>
1770
+ <td><code>getOr(key, fallback)</code></td>
1771
+ <td>Gets a value or returns a fallback</td>
1772
+ </tr>
1773
+ <tr>
1774
+ <td><code>getOrThrow(key, error?)</code></td>
1775
+ <td>Gets a value or throws</td>
1776
+ </tr>
1777
+ <tr>
1778
+ <td><code>getOrCreate(key, make)</code> / <code>ensure(key, make)</code></td>
1779
+ <td>Lazily creates a missing value</td>
1780
+ </tr>
1781
+ <tr>
1782
+ <td><code>update(key, fn, initial)</code></td>
1783
+ <td>Computes and stores an updated value</td>
1784
+ </tr>
1785
+ <tr>
1786
+ <td><code>setIfAbsent(key, value)</code></td>
1787
+ <td>Sets only if the key is absent</td>
1788
+ </tr>
1789
+ <tr>
1790
+ <td><code>setIfPresent(key, value)</code></td>
1791
+ <td>Sets only if the key exists</td>
1792
+ </tr>
1793
+ <tr>
1794
+ <td><code>hasOrSet(key, value)</code></td>
1795
+ <td>Returns whether the key already existed; otherwise sets it</td>
1796
+ </tr>
1797
+ <tr>
1798
+ <td><code>replace(key, value)</code></td>
1799
+ <td>Replaces a value only when the key exists</td>
1800
+ </tr>
1801
+ <tr>
1802
+ <td><code>touch(key)</code></td>
1803
+ <td>Inserts <code>undefined</code> for an absent key</td>
1804
+ </tr>
1805
+ <tr>
1806
+ <td><code>track(key)</code> / <code>untrack(key)</code></td>
1807
+ <td>Enables or removes explicit key tracking</td>
1808
+ </tr>
1809
+ <tr>
1810
+ <td><code>trackedKeys()</code> / <code>trackedValues()</code> / <code>trackedEntries()</code></td>
1811
+ <td>Reads explicitly tracked keys and their current values</td>
1812
+ </tr>
1813
+ <tr>
1814
+ <td><code>forEachTracked(fn)</code></td>
1815
+ <td>Iterates tracked entries still present</td>
1816
+ </tr>
1817
+ <tr>
1818
+ <td><code>clearTracked()</code></td>
1819
+ <td>Deletes tracked keys from the WeakMap and clears tracking</td>
1820
+ </tr>
1821
+ </tbody>
1822
+ </table>
1823
+ <p><strong>Tracking note:</strong> Tracking retains strong references to keys and can prevent garbage collection. Tracking is opt-in.</p>
1824
+ <h2 id="ws2--weakset"><code>WS2</code> — WeakSet</h2>
1825
+ <p>Extends <code>WeakSet&lt;T&gt;</code> with conditional membership, bulk operations, and optional explicit tracking.</p>
1826
+ <table>
1827
+ <thead>
1828
+ <tr>
1829
+ <th>Method</th>
1830
+ <th>Description</th>
1831
+ </tr>
1832
+ </thead>
1833
+ <tbody>
1834
+ <tr>
1835
+ <td><code>addIfAbsent(value)</code></td>
1836
+ <td>Adds only if absent; returns whether it added</td>
1837
+ </tr>
1838
+ <tr>
1839
+ <td><code>toggle(value)</code></td>
1840
+ <td>Adds if absent or deletes if present; returns the new membership state</td>
1841
+ </tr>
1842
+ <tr>
1843
+ <td><code>deleteIfPresent(value)</code></td>
1844
+ <td>Deletes a value if present</td>
1845
+ </tr>
1846
+ <tr>
1847
+ <td><code>hasAll(values)</code> / <code>hasAny(values)</code></td>
1848
+ <td>Checks membership across an iterable</td>
1849
+ </tr>
1850
+ <tr>
1851
+ <td><code>addAll(values)</code></td>
1852
+ <td>Adds multiple values</td>
1853
+ </tr>
1854
+ <tr>
1855
+ <td><code>deleteAll(values)</code></td>
1856
+ <td>Deletes multiple values and returns the deletion count</td>
1857
+ </tr>
1858
+ <tr>
1859
+ <td><code>replace(oldValue, newValue)</code></td>
1860
+ <td>Replaces a member if the old value exists</td>
1861
+ </tr>
1862
+ <tr>
1863
+ <td><code>track(value)</code></td>
1864
+ <td>Adds a value and explicitly tracks it</td>
1865
+ </tr>
1866
+ <tr>
1867
+ <td><code>untrack(value)</code></td>
1868
+ <td>Removes a value from explicit tracking</td>
1869
+ </tr>
1870
+ <tr>
1871
+ <td><code>trackedKeys()</code></td>
1872
+ <td>Returns explicitly tracked values</td>
1873
+ </tr>
1874
+ <tr>
1875
+ <td><code>forEachTracked(callback, thisArg?)</code></td>
1876
+ <td>Iterates tracked values still present in the WeakSet</td>
1877
+ </tr>
1878
+ <tr>
1879
+ <td><code>clearTracked()</code></td>
1880
+ <td>Deletes all explicitly tracked values</td>
1881
+ </tr>
1882
+ </tbody>
1883
+ </table>
1884
+ <p><strong>Tracking note:</strong> Native <code>WeakSet</code> values are not enumerable. These helpers maintain a separate strong-reference <code>Set</code> for tracked values; tracked objects can therefore remain reachable until untracked or cleared.</p>
1885
+ <h2 id="usage">Usage</h2>
1886
+ <p>After the package's initialization module has executed, the registered globals can be used directly:</p>
1887
+ <pre><code class="language-ts"><span class="hljs-keyword">const</span> values = <span class="hljs-keyword">new</span> <span class="hljs-title function_">A2</span>(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>);
1888
+
1889
+ values.<span class="hljs-title function_">unique</span>().<span class="hljs-title function_">chunk</span>(<span class="hljs-number">2</span>);
1890
+ <span class="hljs-comment">// [[1, 2], [3, 4]]</span>
1891
+
1892
+ <span class="hljs-keyword">new</span> <span class="hljs-title function_">N2</span>(<span class="hljs-number">42</span>).<span class="hljs-title function_">clamp</span>(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>).<span class="hljs-title function_">valueOf</span>();
1893
+ <span class="hljs-comment">// 10</span>
1894
+
1895
+ <span class="hljs-keyword">const</span> cache = <span class="hljs-keyword">new</span> <span class="hljs-variable constant_">M2</span>&lt;<span class="hljs-built_in">string</span>, <span class="hljs-built_in">number</span>&gt;();
1896
+ cache.<span class="hljs-title function_">s</span>(<span class="hljs-string">&quot;count&quot;</span>, <span class="hljs-number">1</span>);
1897
+ cache.<span class="hljs-title function_">inc</span>(<span class="hljs-string">&quot;count&quot;</span>);
1898
+ <span class="hljs-comment">// 2</span>
1899
+
1900
+ <span class="hljs-keyword">const</span> iterator = <span class="hljs-keyword">new</span> <span class="hljs-title function_">I2</span>([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]);
1901
+ iterator.<span class="hljs-title function_">filter</span>(<span class="hljs-function"><span class="hljs-params">value</span> =&gt;</span> value % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>).<span class="hljs-title function_">toArray</span>();
1902
+ <span class="hljs-comment">// [2, 4]</span>
1903
+
1904
+ <span class="hljs-keyword">const</span> error = <span class="hljs-title class_">ER2</span>.<span class="hljs-title function_">from</span>(<span class="hljs-string">&quot;Something failed&quot;</span>);
1905
+ error.<span class="hljs-title function_">toJSON</span>();
1906
+ </code></pre>
1907
+
1908
+
1909
+
1910
+ </body>
1911
+ </html>