@the-w1zard/dx 1.0.8 → 1.0.9
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 +823 -121
- package/README.md +288 -107
- package/dist/index.js +12967 -0
- package/package.json +21 -6
- package/src/dx.d.ts +2 -10
- package/src/array.js +0 -221
- package/src/array.ts +0 -301
- package/src/boolean_byte.js +0 -22
- package/src/boolean_byte.ts +0 -23
- package/src/class.js +0 -1
- package/src/class.ts +0 -0
- package/src/date.js +0 -649
- package/src/date.ts +0 -660
- package/src/error.js +0 -60
- package/src/error.ts +0 -81
- package/src/index.js +0 -18
- package/src/index.ts +0 -18
- package/src/iterator.js +0 -386
- package/src/iterator.ts +0 -407
- package/src/map.js +0 -495
- package/src/map.ts +0 -513
- package/src/map_byte.js +0 -483
- package/src/map_byte.ts +0 -422
- package/src/number.js +0 -178
- package/src/number.ts +0 -212
- package/src/object.js +0 -217
- package/src/object.ts +0 -291
- package/src/promise.js +0 -206
- package/src/promise.ts +0 -309
- package/src/reg_ex.js +0 -479
- package/src/reg_ex.ts +0 -423
- package/src/set.js +0 -227
- package/src/set.ts +0 -198
- package/src/set_byte.js +0 -261
- package/src/set_byte.ts +0 -223
- package/src/soa_codec.js +0 -28
- package/src/soa_codec.ts +0 -27
- package/src/string.js +0 -133
- package/src/string.ts +0 -175
- package/src/unit8array.js +0 -272
- package/src/unit8array.ts +0 -374
- package/src/url_search_params.js +0 -172
- package/src/url_search_params.ts +0 -187
- package/src/weak_map.js +0 -136
- package/src/weak_map.ts +0 -155
- package/src/weak_set.js +0 -92
- package/src/weak_set.ts +0 -101
package/README.html
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
</style>
|
|
21
|
-
|
|
21
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
|
|
22
|
+
<link href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css" rel="stylesheet" type="text/css">
|
|
22
23
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
|
|
23
24
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
|
|
24
25
|
<style>
|
|
@@ -140,10 +141,18 @@
|
|
|
140
141
|
<body class="vscode-body vscode-dark">
|
|
141
142
|
<span id="markdown-mermaid" aria-hidden="true" data-config="{"darkModeTheme":"vscode","lightModeTheme":"vscode","maxTextSize":50000,"clickDrag":"alt","showControls":"onHoverOrFocus","resizable":false,"maxHeight":""}"></span>
|
|
142
143
|
<div align="left" style="position: relative;">
|
|
143
|
-
<img src="file:///f:\
|
|
144
|
-
<
|
|
144
|
+
<img src="file:///f:\dx\icons\gandalf.png" align="right" width="30%" style="margin: -20px 0 0 20px;">
|
|
145
|
+
<h3 style="font-size:26px;">DX: <span style="font-size:18px;" >The Wizard's Arsenal</span></h3>
|
|
145
146
|
<p align="left"><em>The most opinionated platform... ever.</em></p>
|
|
146
147
|
<p align="left"><em>Trust me... I'm a fucking wizard... 🧙</em></p>
|
|
148
|
+
<p align="left">Platforms stats:</p>
|
|
149
|
+
<p align="left">
|
|
150
|
+
<img src="https://img.shields.io/badge/LINES OF CODE- 10,300,000-95ED27?style=flat">
|
|
151
|
+
<img src="https://img.shields.io/badge/FEATURES- UNKNOWN-95ED27?style=flat">
|
|
152
|
+
<img src="https://img.shields.io/badge/REACTS RULES ON HOOKS- 0-95ED27?style=flat">
|
|
153
|
+
<img src="https://img.shields.io/badge/DISRUPTORS- 18+-95ED27?style=flat">
|
|
154
|
+
<img src="https://img.shields.io/badge/MESSAGE QUEUES- 5-95ED27?style=flat">
|
|
155
|
+
</p>
|
|
147
156
|
<p align="left">VSCode ext:</p>
|
|
148
157
|
<p align="left">
|
|
149
158
|
<img src="https://img.shields.io/badge/THEMES- 251-95ED27?style=flat">
|
|
@@ -155,14 +164,17 @@
|
|
|
155
164
|
</p>
|
|
156
165
|
<p align="left">Small but powerful repos worth checking out:</p>
|
|
157
166
|
<p align="left">
|
|
158
|
-
<
|
|
159
|
-
<a href="https://github.com/the-w1zard/
|
|
160
|
-
<a href="https://github.com/the-w1zard/
|
|
161
|
-
<a href="https://github.com/the-w1zard/
|
|
162
|
-
<a href="https://github.com/the-w1zard/
|
|
163
|
-
<img src="https://img.shields.io/badge
|
|
164
|
-
<a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge
|
|
165
|
-
<a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge
|
|
167
|
+
<ul>
|
|
168
|
+
<li><a href="https://github.com/the-w1zard/alias_types"><img src="https://img.shields.io/badge/Alias%20Types-000000.svg?style=flat&logo=typescript&logoColor=white" alt="🧙 Alias Types"></a> <a href="https://www.npmjs.com/package/@the-w1zard/alias_types"><img src="file:///f:\dx\icons\npm.png" alt="alias_types" width="20" height="20"></a></li>
|
|
169
|
+
<li><a href="https://github.com/the-w1zard/app_store"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20App%20Store-000000.svg?style=flat" alt="🧙 The Cloud"></a> <a href="https://www.npmjs.com/package/@the-w1zard/store"><img src="file:///f:\dx\icons\npm.png" alt="app_store" width="20" height="20"></a></li>
|
|
170
|
+
<li><a href="https://github.com/the-w1zard/dx"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20DX-95ED27.svg?style=flat" alt="🧙 The Cloud"></a> <a href="https://www.npmjs.com/package/@the-w1zard/dx"><img src="file:///f:\dx\icons\npm.png" alt="dx" width="20" height="20"></a></li>
|
|
171
|
+
<li><a href="https://github.com/the-w1zard/temporal_shift"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20Temporal%20Shift-77AA99.svg?style=flat" alt="🧙 The Cloud"></a> <a href="https://www.npmjs.com/package/@the-w1zard/temporal_shift"><img src="file:///f:\dx\icons\npm.png" alt="temporal_shift" width="20" height="20"></a></li>
|
|
172
|
+
<li><a href="https://github.com/the-w1zard/the_cloud"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20The%20Cloud-02303A.svg?style=flat" alt="🧙 The Cloud"></a> <a href="https://www.npmjs.com/package/@the-w1zard/the-cloud"><img src="file:///f:\dx\icons\npm.png" alt="app_store" width="20" height="20"></a></li>
|
|
173
|
+
<li><a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20SINGULARITY-02303A.svg?style=flat" alt="🧙 SINGULARITY"></a></li>
|
|
174
|
+
<li><a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20Sometimes,%20my%20genius...%20It%20generates%20gravity.-4285F4.svg?style=flat" alt="🧙 Sometimes,%20my%20genius...%20It%20generates%20gravity."></a></li>
|
|
175
|
+
<li><a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20Coming%20Soon:%20The%20Wizard%20Ed.-7F52FF.svg?style=flat" alt="🧙 The Wizard"></a></li>
|
|
176
|
+
<li><a href="https://github.com/the-w1zard"><img src="https://img.shields.io/badge/%F0%9F%A7%99%20Coming%20Soon:%20Hadron%20Particle%20Disruptor-23ED8B00.svg?style=flat" alt="🧙 Hadron Particle Disruptor"></a></li>
|
|
177
|
+
</ul>
|
|
166
178
|
</p>
|
|
167
179
|
<p align="left">The goal? To remove all friction, from everything.</p>
|
|
168
180
|
</div>
|
|
@@ -177,23 +189,60 @@
|
|
|
177
189
|
<p>Extensions to native JavaScript objects that improve developer experience by adding commonly needed operations while preserving the original APIs.</p>
|
|
178
190
|
<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
191
|
<h2 id="table-of-contents">Table of Contents</h2>
|
|
192
|
+
<ul style="list-style: none; padding-left: 0;">
|
|
193
|
+
<li><a href="#a2--array">A2 — Array</a></li>
|
|
194
|
+
<li><a href="#b2--byte-bool">B2 — Byte Boolean</a></li>
|
|
195
|
+
<li><a href="#d2--date">D2 — Date</a></li>
|
|
196
|
+
<li><a href="#er2--error">ER2 — Error</a></li>
|
|
197
|
+
<li><a href="#i2--iterator">I2 — Iterator</a></li>
|
|
198
|
+
<li><a href="#m2--map">M2 — Map</a></li>
|
|
199
|
+
<li><a href="#m2b--map-binary">M2B — Map Binary</a></li>
|
|
200
|
+
<li><a href="#n2--number">N2 — Number</a></li>
|
|
201
|
+
<li><a href="#o2--object">O2 — Object</a></li>
|
|
202
|
+
<li><a href="#p2--promise">P2 — Promise</a></li>
|
|
203
|
+
<li><a href="#usp2--urlsearchparams">USP2 — URLSearchParams</a></li>
|
|
204
|
+
<li><a href="#u82--array">U82 — Uint8Array</a></li>
|
|
205
|
+
<li><a href="#s2--string">S2 — String</a></li>
|
|
206
|
+
<li><a href="#ws2--weakset">WS2 — WeakSet</a></li>
|
|
207
|
+
<li><a href="#wm2--weakmap">WM2 — WeakMap</a></li>
|
|
208
|
+
<li><a href="#o2--object">O2 — Object</a></li>
|
|
209
|
+
<li><a href="#set2--set">SET2 — Set</a></li>
|
|
210
|
+
<li><a href="#set2b--set-binary">SET2B — Set Binary</a></li>
|
|
211
|
+
</ul>
|
|
212
|
+
<div class="markdown-alert markdown-alert-important"><p class="markdown-alert-title"><svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>UPDATE!!@!</p><p></p>
|
|
213
|
+
<p>Where appropriate, there will be some additional functions that will surface as a complete byteop variant where each of the currently defined functions within this solution, will be getting a complete brother... or sister to stand beside it.</p>
|
|
214
|
+
<p>This is not a priority for the solution, merely some extra goodies.</p>
|
|
215
|
+
<p>With the performance difference between the two, I have found the use case for myself to create binary versions of each. Items like map and set are already in play and can be used. Items like array, will not be getting conversions.
|
|
216
|
+
Conversions completed so far:</p>
|
|
180
217
|
<ul>
|
|
181
|
-
<li
|
|
182
|
-
<
|
|
183
|
-
<li
|
|
184
|
-
<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>
|
|
218
|
+
<li>map
|
|
219
|
+
<ul>
|
|
220
|
+
<li>fn: M2B</li>
|
|
221
|
+
<li>interface: M2BI</li>
|
|
196
222
|
</ul>
|
|
223
|
+
</li>
|
|
224
|
+
<li>set
|
|
225
|
+
<ul>
|
|
226
|
+
<li>fn: SET2B</li>
|
|
227
|
+
<li>interface: SET2BI</li>
|
|
228
|
+
</ul>
|
|
229
|
+
</li>
|
|
230
|
+
<li>boolean
|
|
231
|
+
<ul>
|
|
232
|
+
<li>fn: B2B</li>
|
|
233
|
+
<li>interface: B2BI</li>
|
|
234
|
+
</ul>
|
|
235
|
+
</li>
|
|
236
|
+
</ul>
|
|
237
|
+
<p>Each fn available globally, so your free to call without actually importing the implementation itself. The byteop variants will be mirror versions.</p>
|
|
238
|
+
<p>For the ones that aren't familiar, don't worry I got you...</p>
|
|
239
|
+
<p>There will be some accompanying utilities that will help with the use of the new fns as they either need to be converted to binary, or have values converted to use a pid in its place.</p>
|
|
240
|
+
<p>The pid converter will come with a 1-1 conversion as well as the ability to convert using the 3/4 scoped channel format.</p>
|
|
241
|
+
<p>Due to wanting to create the absolute dx possible, despite making a much more complex system available... each of the fns with have the same named fn, taking in the same props where applicable. For exmaple, getNestedMap... already has a stand in... getNestedMap, but inside the byte orientated class, taking in the same 3 props.</p>
|
|
242
|
+
<p>There will be 2 encoders available, cbor and avro.</p>
|
|
243
|
+
<p>Cbor being a bit more... lenient of the two, I guess is the right word. As you simply call upon encode or decode... and away you go. Where as with avro, you do need to set up a defined shapped schema in order to use it. Both of their use cases, but avro compresses to a much smaller figure and is 6x faster than cbor, if I remember correctly. It doesn't sound like much... but at these speed it adds up to a lot.</p>
|
|
244
|
+
<p>For example, while acheiving the 900+ mill ops/sec with benching, obviously that is not a realistic goal when it comes to the users usage path, but we need to get as close as we can and having a 6x mulitplier when your doing 900 mill ops/sec... is fucking huge.</p>
|
|
245
|
+
</div>
|
|
197
246
|
<h2 id="global-apis">Global APIs</h2>
|
|
198
247
|
<table>
|
|
199
248
|
<thead>
|
|
@@ -410,7 +459,49 @@
|
|
|
410
459
|
</tbody>
|
|
411
460
|
</table>
|
|
412
461
|
<p>Static helpers include <code>A2I.from()</code> and <code>A2I.of()</code>.</p>
|
|
462
|
+
<h2 id="b2--byte-bool"><code>B2</code> — Byte Bool</h2>
|
|
463
|
+
<p><code>B2I</code> replaces boolean properties and boolean maps with a zero-allocation, PID-indexed <code>Uint8Array</code> lane. One byte per PID, no boxing, no <code>Map</code>, no per-entry allocation — <code>set</code>, <code>get</code>, and <code>toggle</code> are O(1) array stores, and <code>clear</code> is a single <code>fill(0)</code>.</p>
|
|
464
|
+
<table>
|
|
465
|
+
<thead>
|
|
466
|
+
<tr>
|
|
467
|
+
<th>Method</th>
|
|
468
|
+
<th>Description</th>
|
|
469
|
+
</tr>
|
|
470
|
+
</thead>
|
|
471
|
+
<tbody>
|
|
472
|
+
<tr>
|
|
473
|
+
<td><code>set(pid, value)</code></td>
|
|
474
|
+
<td>Set the boolean flag for a PID</td>
|
|
475
|
+
</tr>
|
|
476
|
+
<tr>
|
|
477
|
+
<td><code>true(pid, value)</code></td>
|
|
478
|
+
<td>Set the flag to <code>1</code> (<code>value</code> is accepted for call-site symmetry and ignored)</td>
|
|
479
|
+
</tr>
|
|
480
|
+
<tr>
|
|
481
|
+
<td><code>false(pid, value)</code></td>
|
|
482
|
+
<td>Set the flag to <code>0</code> (<code>value</code> is accepted for call-site symmetry and ignored)</td>
|
|
483
|
+
</tr>
|
|
484
|
+
<tr>
|
|
485
|
+
<td><code>get(pid)</code></td>
|
|
486
|
+
<td>Return <code>true</code> if the PID's flag is <code>1</code>, else <code>false</code></td>
|
|
487
|
+
</tr>
|
|
488
|
+
<tr>
|
|
489
|
+
<td><code>toggle(pid)</code></td>
|
|
490
|
+
<td>Flip the PID's flag and return the new state</td>
|
|
491
|
+
</tr>
|
|
492
|
+
<tr>
|
|
493
|
+
<td><code>clear()</code></td>
|
|
494
|
+
<td>Zero every flag in place; no reallocation</td>
|
|
495
|
+
</tr>
|
|
496
|
+
<tr>
|
|
497
|
+
<td><code>flags</code></td>
|
|
498
|
+
<td>The backing <code>Uint8Array</code>, indexed by PID</td>
|
|
499
|
+
</tr>
|
|
500
|
+
</tbody>
|
|
501
|
+
</table>
|
|
413
502
|
<h2 id="d2--date"><code>D2</code> — Date</h2>
|
|
503
|
+
<p><code>D2</code> extends <code>Date</code> and keeps the standard <code>Date</code> API, adding immutable date arithmetic, calendar helpers, human-readable diffs, custom formatting, and locale-aware parsing. Every method returns a new <code>D2I</code>; the receiver is never mutated.</p>
|
|
504
|
+
<p>Registered as a codec (<code>DATE_TAG = 0x4432</code>, <code>"D2"</code>): <code>enc</code> writes the epoch-ms as an <code>i64</code>, <code>dec</code> revives it as a <code>D2I</code>.</p>
|
|
414
505
|
<table>
|
|
415
506
|
<thead>
|
|
416
507
|
<tr>
|
|
@@ -420,93 +511,269 @@
|
|
|
420
511
|
</thead>
|
|
421
512
|
<tbody>
|
|
422
513
|
<tr>
|
|
423
|
-
<td><code>
|
|
424
|
-
<td>
|
|
514
|
+
<td><code>set(f)</code></td>
|
|
515
|
+
<td>Return a new date with the given <code>{ year, month, day, hour, minute, second, ms }</code> fields applied; unset fields are preserved, <code>day</code> is clamped to the target month</td>
|
|
425
516
|
</tr>
|
|
426
517
|
<tr>
|
|
427
|
-
<td><code>
|
|
428
|
-
<td>
|
|
518
|
+
<td><code>withDate(year, month, day)</code></td>
|
|
519
|
+
<td>Replace the calendar date, keep the time</td>
|
|
429
520
|
</tr>
|
|
430
521
|
<tr>
|
|
431
|
-
<td><code>
|
|
432
|
-
<td>
|
|
522
|
+
<td><code>sameTimeOn(other)</code></td>
|
|
523
|
+
<td>Keep this date's time, adopt <code>other</code>'s calendar date</td>
|
|
433
524
|
</tr>
|
|
434
525
|
<tr>
|
|
435
|
-
<td><code>
|
|
436
|
-
<td>
|
|
526
|
+
<td><code>at(hour, minute?, second?, ms?)</code></td>
|
|
527
|
+
<td>Return a new date at the given time on this date</td>
|
|
437
528
|
</tr>
|
|
438
529
|
<tr>
|
|
439
|
-
<td><code>
|
|
440
|
-
<td>
|
|
530
|
+
<td><code>atNoon()</code> / <code>midnight()</code></td>
|
|
531
|
+
<td><code>at(12)</code> / <code>startOfDay()</code></td>
|
|
441
532
|
</tr>
|
|
442
533
|
<tr>
|
|
443
|
-
<td><code>
|
|
444
|
-
<td>
|
|
534
|
+
<td><code>toInputDate()</code> / <code>toInputTime()</code> / <code>toInputDateTime()</code> / <code>toInputTimeWithSeconds()</code></td>
|
|
535
|
+
<td><code>YYYY-MM-DD</code>, <code>HH:mm</code>, <code>YYYY-MM-DDTHH:mm</code>, <code>HH:mm:ss</code> for form inputs</td>
|
|
445
536
|
</tr>
|
|
537
|
+
</tbody>
|
|
538
|
+
</table>
|
|
539
|
+
<h3 id="arithmetic">Arithmetic</h3>
|
|
540
|
+
<table>
|
|
541
|
+
<thead>
|
|
446
542
|
<tr>
|
|
447
|
-
<
|
|
448
|
-
<
|
|
543
|
+
<th>Method</th>
|
|
544
|
+
<th>Description</th>
|
|
449
545
|
</tr>
|
|
546
|
+
</thead>
|
|
547
|
+
<tbody>
|
|
548
|
+
<tr>
|
|
549
|
+
<td><code>addMs</code> / <code>addSeconds</code> / <code>addMinutes</code> / <code>addHours</code> / <code>addDays</code> / <code>addWeeks</code> / <code>addMonths</code> / <code>addYears</code></td>
|
|
550
|
+
<td>Return a new date shifted by the amount</td>
|
|
551
|
+
</tr>
|
|
552
|
+
<tr>
|
|
553
|
+
<td><code>subDays</code> / <code>subWeeks</code> / <code>subMonths</code> / <code>subYears</code></td>
|
|
554
|
+
<td>Negative-shift shorthand</td>
|
|
555
|
+
</tr>
|
|
556
|
+
<tr>
|
|
557
|
+
<td><code>addBusinessDays(n)</code> / <code>nextBusinessDay()</code> / <code>prevBusinessDay()</code></td>
|
|
558
|
+
<td>Shift by weekdays, skipping weekends</td>
|
|
559
|
+
</tr>
|
|
560
|
+
<tr>
|
|
561
|
+
<td><code>next(unit)</code> / <code>prev(unit)</code></td>
|
|
562
|
+
<td>Next/previous <code>day</code>, <code>week</code>, <code>month</code>, <code>quarter</code>, <code>year</code>, or weekday name (<code>"friday"</code>)</td>
|
|
563
|
+
</tr>
|
|
564
|
+
<tr>
|
|
565
|
+
<td><code>nextWeek</code> / <code>prevWeek</code> / <code>nextMonth</code> / <code>prevMonth</code> / <code>nextQuarter</code> / <code>prevQuarter</code> / <code>nextYear</code> / <code>prevYear</code></td>
|
|
566
|
+
<td>Named shorthands</td>
|
|
567
|
+
</tr>
|
|
568
|
+
</tbody>
|
|
569
|
+
</table>
|
|
570
|
+
<h3 id="boundaries">Boundaries</h3>
|
|
571
|
+
<table>
|
|
572
|
+
<thead>
|
|
450
573
|
<tr>
|
|
451
|
-
<
|
|
452
|
-
<
|
|
574
|
+
<th>Method</th>
|
|
575
|
+
<th>Description</th>
|
|
453
576
|
</tr>
|
|
577
|
+
</thead>
|
|
578
|
+
<tbody>
|
|
454
579
|
<tr>
|
|
455
|
-
<td><code>startOfDay
|
|
456
|
-
<td>
|
|
580
|
+
<td><code>startOfDay</code> / <code>endOfDay</code></td>
|
|
581
|
+
<td>Local day boundaries</td>
|
|
457
582
|
</tr>
|
|
458
583
|
<tr>
|
|
459
|
-
<td><code>startOfWeek()</code> / <code>endOfWeek()</code></td>
|
|
460
|
-
<td>Week boundaries</td>
|
|
584
|
+
<td><code>startOfWeek(weekStartsOn?)</code> / <code>endOfWeek(weekStartsOn?)</code></td>
|
|
585
|
+
<td>Week boundaries; <code>weekStartsOn</code> defaults to <code>0</code> (Sunday)</td>
|
|
461
586
|
</tr>
|
|
462
587
|
<tr>
|
|
463
|
-
<td><code>startOfMonth
|
|
588
|
+
<td><code>startOfMonth</code> / <code>endOfMonth</code></td>
|
|
464
589
|
<td>Month boundaries</td>
|
|
465
590
|
</tr>
|
|
466
591
|
<tr>
|
|
467
|
-
<td><code>startOfQuarter
|
|
592
|
+
<td><code>startOfQuarter</code> / <code>endOfQuarter</code></td>
|
|
468
593
|
<td>Quarter boundaries</td>
|
|
469
594
|
</tr>
|
|
470
595
|
<tr>
|
|
471
|
-
<td><code>startOfYear
|
|
596
|
+
<td><code>startOfYear</code> / <code>endOfYear</code></td>
|
|
472
597
|
<td>Year boundaries</td>
|
|
473
598
|
</tr>
|
|
599
|
+
</tbody>
|
|
600
|
+
</table>
|
|
601
|
+
<h3 id="fields-and-predicates">Fields and predicates</h3>
|
|
602
|
+
<table>
|
|
603
|
+
<thead>
|
|
604
|
+
<tr>
|
|
605
|
+
<th>Method</th>
|
|
606
|
+
<th>Description</th>
|
|
607
|
+
</tr>
|
|
608
|
+
</thead>
|
|
609
|
+
<tbody>
|
|
610
|
+
<tr>
|
|
611
|
+
<td><code>month()</code></td>
|
|
612
|
+
<td>1-based month</td>
|
|
613
|
+
</tr>
|
|
614
|
+
<tr>
|
|
615
|
+
<td><code>dateOfWeek()</code> / <code>dayOfYear()</code> / <code>quarter()</code></td>
|
|
616
|
+
<td>Calendar fields</td>
|
|
617
|
+
</tr>
|
|
618
|
+
<tr>
|
|
619
|
+
<td><code>daysInMonth()</code> / <code>daysInYear()</code> / <code>isLeapYear()</code></td>
|
|
620
|
+
<td>Calendar facts</td>
|
|
621
|
+
</tr>
|
|
622
|
+
<tr>
|
|
623
|
+
<td><code>isWeekend()</code> / <code>isWeekday()</code> / <code>isBusinessDay()</code></td>
|
|
624
|
+
<td>Day-type predicates</td>
|
|
625
|
+
</tr>
|
|
626
|
+
<tr>
|
|
627
|
+
<td><code>isBefore</code> / <code>isAfter</code> / <code>isEqual</code> / <code>isBetween</code> / <code>isSameOrBefore</code> / <code>isSameOrAfter</code></td>
|
|
628
|
+
<td>Instant comparison</td>
|
|
629
|
+
</tr>
|
|
630
|
+
<tr>
|
|
631
|
+
<td><code>sameDay</code> / <code>sameMonth</code> / <code>sameYear</code> / <code>isSame(unit, other)</code></td>
|
|
632
|
+
<td>Calendar comparison</td>
|
|
633
|
+
</tr>
|
|
634
|
+
<tr>
|
|
635
|
+
<td><code>isToday</code> / <code>isTomorrow</code> / <code>isYesterday</code></td>
|
|
636
|
+
<td>Relative-day predicates</td>
|
|
637
|
+
</tr>
|
|
638
|
+
<tr>
|
|
639
|
+
<td><code>clamp(min, max)</code></td>
|
|
640
|
+
<td>Clamp into a range</td>
|
|
641
|
+
</tr>
|
|
642
|
+
</tbody>
|
|
643
|
+
</table>
|
|
644
|
+
<h3 id="differences">Differences</h3>
|
|
645
|
+
<table>
|
|
646
|
+
<thead>
|
|
647
|
+
<tr>
|
|
648
|
+
<th>Method</th>
|
|
649
|
+
<th>Description</th>
|
|
650
|
+
</tr>
|
|
651
|
+
</thead>
|
|
652
|
+
<tbody>
|
|
653
|
+
<tr>
|
|
654
|
+
<td><code>diffMs</code> / <code>diffSeconds</code> / <code>diffMinutes</code> / <code>diffHours</code> / <code>diffDays</code></td>
|
|
655
|
+
<td>Numeric difference from <code>other</code></td>
|
|
656
|
+
</tr>
|
|
657
|
+
<tr>
|
|
658
|
+
<td><code>calendarDays(other)</code></td>
|
|
659
|
+
<td>Whole calendar days between the two dates</td>
|
|
660
|
+
</tr>
|
|
661
|
+
<tr>
|
|
662
|
+
<td><code>businessDays(other)</code></td>
|
|
663
|
+
<td>Weekdays between the two dates</td>
|
|
664
|
+
</tr>
|
|
665
|
+
<tr>
|
|
666
|
+
<td><code>diffHuman(other?)</code></td>
|
|
667
|
+
<td>Compact human diff, e.g. <code>"3d"</code></td>
|
|
668
|
+
</tr>
|
|
669
|
+
<tr>
|
|
670
|
+
<td><code>fromNow()</code> / <code>ago()</code></td>
|
|
671
|
+
<td>Relative description, e.g. <code>"in 2 hours"</code>, <code>"3 minutes ago"</code></td>
|
|
672
|
+
</tr>
|
|
673
|
+
<tr>
|
|
674
|
+
<td><code>from(other)</code></td>
|
|
675
|
+
<td>Relative description vs. <code>other</code></td>
|
|
676
|
+
</tr>
|
|
677
|
+
<tr>
|
|
678
|
+
<td><code>age(unit?)</code></td>
|
|
679
|
+
<td>Elapsed years/months/days since this date</td>
|
|
680
|
+
</tr>
|
|
681
|
+
</tbody>
|
|
682
|
+
</table>
|
|
683
|
+
<h3 id="formatting-and-parsing">Formatting and parsing</h3>
|
|
684
|
+
<table>
|
|
685
|
+
<thead>
|
|
686
|
+
<tr>
|
|
687
|
+
<th>Method</th>
|
|
688
|
+
<th>Description</th>
|
|
689
|
+
</tr>
|
|
690
|
+
</thead>
|
|
691
|
+
<tbody>
|
|
692
|
+
<tr>
|
|
693
|
+
<td><code>fmt(format)</code></td>
|
|
694
|
+
<td>Token substitution: <code>YYYY</code>, <code>YY</code>, <code>MMMM</code>, <code>MMM</code>, <code>MM</code>, <code>M</code>, <code>DD</code>, <code>D</code>, <code>dddd</code>, <code>ddd</code>, <code>HH</code>, <code>H</code>, <code>hh</code>, <code>h</code>, <code>mm</code>, <code>m</code>, <code>ss</code>, <code>s</code>, <code>SSS</code>, <code>A</code>, <code>a</code></td>
|
|
695
|
+
</tr>
|
|
696
|
+
<tr>
|
|
697
|
+
<td><code>toLocalString(format?)</code></td>
|
|
698
|
+
<td><code>toLocaleString("en-US", format)</code>; <code>format</code> defaults to <code>FORMAT.full</code></td>
|
|
699
|
+
</tr>
|
|
700
|
+
<tr>
|
|
701
|
+
<td><code>D2.from(value)</code></td>
|
|
702
|
+
<td>Parse from <code>Date</code>, number (epoch ms), ISO string, <code>YYYY-MM-DD</code>, <code>YYYY-MM-DD HH:mm</code>, array <code>[y,m,d,h?,min?,s?,ms?]</code>, or object (<code>{ date, time }</code> or <code>{ year, month, day, … }</code>)</td>
|
|
703
|
+
</tr>
|
|
704
|
+
<tr>
|
|
705
|
+
<td><code>D2.parseDate("YYYY-MM-DD")</code></td>
|
|
706
|
+
<td>Local midnight for that date</td>
|
|
707
|
+
</tr>
|
|
708
|
+
<tr>
|
|
709
|
+
<td><code>D2.parseDateTime("YYYY-MM-DD HH:mm")</code></td>
|
|
710
|
+
<td>Local date-time</td>
|
|
711
|
+
</tr>
|
|
712
|
+
<tr>
|
|
713
|
+
<td><code>D2.fromParts(y, m, d, h?, min?, s?, ms?)</code></td>
|
|
714
|
+
<td>Construct from calendar parts</td>
|
|
715
|
+
</tr>
|
|
716
|
+
</tbody>
|
|
717
|
+
</table>
|
|
718
|
+
<h3 id="statics">Statics</h3>
|
|
719
|
+
<table>
|
|
720
|
+
<thead>
|
|
721
|
+
<tr>
|
|
722
|
+
<th>Method</th>
|
|
723
|
+
<th>Description</th>
|
|
724
|
+
</tr>
|
|
725
|
+
</thead>
|
|
726
|
+
<tbody>
|
|
474
727
|
<tr>
|
|
475
|
-
<td><code>
|
|
476
|
-
<td>
|
|
728
|
+
<td><code>D2.now()</code> / <code>D2.today()</code></td>
|
|
729
|
+
<td>Current instant / today's <code>startOfDay()</code></td>
|
|
477
730
|
</tr>
|
|
478
731
|
<tr>
|
|
479
|
-
<td><code>
|
|
480
|
-
<td>
|
|
732
|
+
<td><code>D2.fromUnix(s)</code> / <code>D2.fromUnixMs(ms)</code></td>
|
|
733
|
+
<td>Construct from epoch seconds / milliseconds</td>
|
|
481
734
|
</tr>
|
|
482
735
|
<tr>
|
|
483
|
-
<td><code>
|
|
484
|
-
<td>
|
|
736
|
+
<td><code>D2.min(...dates)</code> / <code>D2.max(...dates)</code></td>
|
|
737
|
+
<td>Earliest / latest of the inputs</td>
|
|
485
738
|
</tr>
|
|
739
|
+
</tbody>
|
|
740
|
+
</table>
|
|
741
|
+
<h3 id="ranges">Ranges</h3>
|
|
742
|
+
<p><code>R2I</code> is a half-open <code>[start, end)</code> interval.</p>
|
|
743
|
+
<table>
|
|
744
|
+
<thead>
|
|
486
745
|
<tr>
|
|
487
|
-
<
|
|
488
|
-
<
|
|
746
|
+
<th>Method</th>
|
|
747
|
+
<th>Description</th>
|
|
748
|
+
</tr>
|
|
749
|
+
</thead>
|
|
750
|
+
<tbody>
|
|
751
|
+
<tr>
|
|
752
|
+
<td><code>contains(d)</code></td>
|
|
753
|
+
<td>Whether <code>d</code> falls inside the range</td>
|
|
489
754
|
</tr>
|
|
490
755
|
<tr>
|
|
491
|
-
<td><code>
|
|
492
|
-
<td>
|
|
756
|
+
<td><code>overlaps(other)</code></td>
|
|
757
|
+
<td>Whether two ranges intersect</td>
|
|
493
758
|
</tr>
|
|
494
759
|
<tr>
|
|
495
|
-
<td><code>
|
|
496
|
-
<td>
|
|
760
|
+
<td><code>durationMs()</code> / <code>days()</code></td>
|
|
761
|
+
<td>Length in ms / whole days</td>
|
|
497
762
|
</tr>
|
|
498
763
|
<tr>
|
|
499
|
-
<td><code>
|
|
500
|
-
<td>
|
|
764
|
+
<td><code>eachDay(fn)</code></td>
|
|
765
|
+
<td>Iterate each calendar day in the range</td>
|
|
766
|
+
</tr>
|
|
767
|
+
<tr>
|
|
768
|
+
<td><code>toArray()</code></td>
|
|
769
|
+
<td><code>A2I<D2></code> of days</td>
|
|
501
770
|
</tr>
|
|
502
771
|
<tr>
|
|
503
|
-
<td><code>
|
|
504
|
-
<td>
|
|
772
|
+
<td><code>R2(start, end)</code></td>
|
|
773
|
+
<td>Build a range from any two <code>D2</code>-coercible values</td>
|
|
505
774
|
</tr>
|
|
506
775
|
</tbody>
|
|
507
776
|
</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
777
|
<h2 id="er2--error"><code>ER2</code> — Error</h2>
|
|
511
778
|
<table>
|
|
512
779
|
<thead>
|
|
@@ -550,9 +817,9 @@
|
|
|
550
817
|
</tr>
|
|
551
818
|
</tbody>
|
|
552
819
|
</table>
|
|
553
|
-
<p><code>
|
|
820
|
+
<p><code>ER2</code> accepts an optional message and standard <code>ErrorOptions</code>, including <code>cause</code>.</p>
|
|
554
821
|
<h2 id="i2--iterator"><code>I2</code> — Iterator</h2>
|
|
555
|
-
<p><code>
|
|
822
|
+
<p><code>I2</code> wraps an iterable or iterator and provides lazy transformation pipelines.</p>
|
|
556
823
|
<table>
|
|
557
824
|
<thead>
|
|
558
825
|
<tr>
|
|
@@ -672,7 +939,7 @@
|
|
|
672
939
|
</tbody>
|
|
673
940
|
</table>
|
|
674
941
|
<h2 id="m2--map"><code>M2</code> — Map</h2>
|
|
675
|
-
<p><code>
|
|
942
|
+
<p><code>M2</code> extends <code>Map</code> and retains the standard <code>Map</code> API, plus reactive subscriptions, derived values, batching, and a large set of convenience methods. Keys are arbitrary — any value <code>Map</code> accepts, <code>M2</code> accepts.</p>
|
|
676
943
|
<table>
|
|
677
944
|
<thead>
|
|
678
945
|
<tr>
|
|
@@ -682,15 +949,23 @@
|
|
|
682
949
|
</thead>
|
|
683
950
|
<tbody>
|
|
684
951
|
<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>
|
|
952
|
+
<td><code>g(key)</code> / <code>h(key)</code> / <code>d(key)</code> / <code>c()</code></td>
|
|
953
|
+
<td>Aliases for <code>get</code>, <code>has</code>, <code>delete</code>, and <code>clear</code></td>
|
|
687
954
|
</tr>
|
|
688
955
|
<tr>
|
|
689
|
-
<td><code>
|
|
690
|
-
<td>
|
|
956
|
+
<td><code>f</code></td>
|
|
957
|
+
<td>Alias for <code>forEach</code></td>
|
|
691
958
|
</tr>
|
|
692
959
|
<tr>
|
|
693
|
-
<td><code>
|
|
960
|
+
<td><code>s(value, key)</code></td>
|
|
961
|
+
<td>Set a value; function arguments are evaluated as factories</td>
|
|
962
|
+
</tr>
|
|
963
|
+
<tr>
|
|
964
|
+
<td><code>mutate(key, fn)</code></td>
|
|
965
|
+
<td>Update an existing value in place using the current value</td>
|
|
966
|
+
</tr>
|
|
967
|
+
<tr>
|
|
968
|
+
<td><code>swap(value, key)</code></td>
|
|
694
969
|
<td>Replace a value and return the previous value</td>
|
|
695
970
|
</tr>
|
|
696
971
|
<tr>
|
|
@@ -702,27 +977,27 @@
|
|
|
702
977
|
<td>Return the value or <code>false</code> if absent</td>
|
|
703
978
|
</tr>
|
|
704
979
|
<tr>
|
|
705
|
-
<td><code>getOrI(
|
|
980
|
+
<td><code>getOrI(value, key)</code></td>
|
|
706
981
|
<td>Get or insert a supplied value</td>
|
|
707
982
|
</tr>
|
|
708
983
|
<tr>
|
|
709
|
-
<td><code>getOrM(
|
|
984
|
+
<td><code>getOrM(make, key)</code></td>
|
|
710
985
|
<td>Get or lazily create a value</td>
|
|
711
986
|
</tr>
|
|
712
987
|
<tr>
|
|
713
|
-
<td><code>update(key, fn, initial)</code></td>
|
|
714
|
-
<td>Update using the current value or initial value</td>
|
|
988
|
+
<td><code>update(key, fn, initial?)</code></td>
|
|
989
|
+
<td>Update using the current value, or an initial value if missing</td>
|
|
715
990
|
</tr>
|
|
716
991
|
<tr>
|
|
717
|
-
<td><code>setIfAbsent(
|
|
992
|
+
<td><code>setIfAbsent(value, key)</code></td>
|
|
718
993
|
<td>Insert only when missing</td>
|
|
719
994
|
</tr>
|
|
720
995
|
<tr>
|
|
721
|
-
<td><code>setIfPresent(
|
|
996
|
+
<td><code>setIfPresent(value, key)</code></td>
|
|
722
997
|
<td>Set only when present</td>
|
|
723
998
|
</tr>
|
|
724
999
|
<tr>
|
|
725
|
-
<td><code>replace(
|
|
1000
|
+
<td><code>replace(value, key)</code></td>
|
|
726
1001
|
<td>Replace only when present</td>
|
|
727
1002
|
</tr>
|
|
728
1003
|
<tr>
|
|
@@ -735,7 +1010,7 @@
|
|
|
735
1010
|
</tr>
|
|
736
1011
|
<tr>
|
|
737
1012
|
<td><code>mapValues(fn)</code> / <code>mapKeys(fn)</code></td>
|
|
738
|
-
<td>Transform values or keys</td>
|
|
1013
|
+
<td>Transform values or keys into a new map</td>
|
|
739
1014
|
</tr>
|
|
740
1015
|
<tr>
|
|
741
1016
|
<td><code>filterKV(pred)</code> / <code>filterKeys(pred)</code></td>
|
|
@@ -771,7 +1046,7 @@
|
|
|
771
1046
|
</tr>
|
|
772
1047
|
<tr>
|
|
773
1048
|
<td><code>group(fn)</code></td>
|
|
774
|
-
<td>Group values by computed key</td>
|
|
1049
|
+
<td>Group values by computed key, into a map of <code>A2</code> buckets</td>
|
|
775
1050
|
</tr>
|
|
776
1051
|
<tr>
|
|
777
1052
|
<td><code>unique(fn?)</code></td>
|
|
@@ -787,7 +1062,7 @@
|
|
|
787
1062
|
</tr>
|
|
788
1063
|
<tr>
|
|
789
1064
|
<td><code>clearAndSet(entries)</code></td>
|
|
790
|
-
<td>Replace all entries</td>
|
|
1065
|
+
<td>Replace all entries as a single batch</td>
|
|
791
1066
|
</tr>
|
|
792
1067
|
<tr>
|
|
793
1068
|
<td><code>toObject()</code></td>
|
|
@@ -795,7 +1070,7 @@
|
|
|
795
1070
|
</tr>
|
|
796
1071
|
<tr>
|
|
797
1072
|
<td><code>toArray()</code> / <code>toKeys()</code> / <code>toValues()</code></td>
|
|
798
|
-
<td>Convert entries, keys, or values to
|
|
1073
|
+
<td>Convert entries, keys, or values to an <code>A2</code></td>
|
|
799
1074
|
</tr>
|
|
800
1075
|
<tr>
|
|
801
1076
|
<td><code>clone()</code></td>
|
|
@@ -803,7 +1078,47 @@
|
|
|
803
1078
|
</tr>
|
|
804
1079
|
<tr>
|
|
805
1080
|
<td><code>equals(other)</code></td>
|
|
806
|
-
<td>Compare keys and values</td>
|
|
1081
|
+
<td>Compare keys and values by value-aware equality</td>
|
|
1082
|
+
</tr>
|
|
1083
|
+
<tr>
|
|
1084
|
+
<td><code>on(fn)</code></td>
|
|
1085
|
+
<td>Subscribe to change events; returns an unsubscribe function</td>
|
|
1086
|
+
</tr>
|
|
1087
|
+
<tr>
|
|
1088
|
+
<td><code>off(fn)</code></td>
|
|
1089
|
+
<td>Unsubscribe a listener</td>
|
|
1090
|
+
</tr>
|
|
1091
|
+
<tr>
|
|
1092
|
+
<td><code>batch(fn)</code></td>
|
|
1093
|
+
<td>Run multiple writes, coalescing into one event per key</td>
|
|
1094
|
+
</tr>
|
|
1095
|
+
<tr>
|
|
1096
|
+
<td><code>dv(key, deps, fn)</code></td>
|
|
1097
|
+
<td>Define a derived value computed from other keys</td>
|
|
1098
|
+
</tr>
|
|
1099
|
+
<tr>
|
|
1100
|
+
<td><code>dirty(...keys)</code></td>
|
|
1101
|
+
<td>Mark derived values as needing recomputation</td>
|
|
1102
|
+
</tr>
|
|
1103
|
+
<tr>
|
|
1104
|
+
<td><code>$debug(limit?)</code></td>
|
|
1105
|
+
<td>Enable event history tracking</td>
|
|
1106
|
+
</tr>
|
|
1107
|
+
<tr>
|
|
1108
|
+
<td><code>$strict()</code></td>
|
|
1109
|
+
<td>Throw if mutated while iterating</td>
|
|
1110
|
+
</tr>
|
|
1111
|
+
<tr>
|
|
1112
|
+
<td><code>$history()</code></td>
|
|
1113
|
+
<td>Return recorded change events</td>
|
|
1114
|
+
</tr>
|
|
1115
|
+
<tr>
|
|
1116
|
+
<td><code>$why(key)</code></td>
|
|
1117
|
+
<td>Return the most recent event for a key</td>
|
|
1118
|
+
</tr>
|
|
1119
|
+
<tr>
|
|
1120
|
+
<td><code>$diff(other)</code></td>
|
|
1121
|
+
<td>Compare against another map: added, deleted, and changed entries</td>
|
|
807
1122
|
</tr>
|
|
808
1123
|
<tr>
|
|
809
1124
|
<td><code>fromObject(obj)</code></td>
|
|
@@ -819,6 +1134,204 @@
|
|
|
819
1134
|
</tr>
|
|
820
1135
|
</tbody>
|
|
821
1136
|
</table>
|
|
1137
|
+
<h2 id="m2b--map-binary"><code>M2B</code> — Map binary</h2>
|
|
1138
|
+
<p><code>M2B</code> is the dense, PID-indexed backing store for <code>M2</code>. Where <code>M2</code> accepts arbitrary keys and stores values in a <code>Map</code>, <code>M2B</code> stores fixed-width values in a flat <code>Float64Array</code>, indexed by integer PID. <code>pidToSlot</code> / <code>slotToPid</code> give O(1) lookup in both directions, and iteration walks the dense slot range — no hashing, no per-entry allocation.</p>
|
|
1139
|
+
<p><code>stride</code> controls how many doubles each PID holds: <code>stride = 1</code> stores scalars (<code>number</code>), <code>stride > 1</code> stores fixed-length <code>Float64Array</code> views. <code>cap</code> is the maximum PID; values outside <code>[0, cap)</code> read as absent.</p>
|
|
1140
|
+
<table>
|
|
1141
|
+
<thead>
|
|
1142
|
+
<tr>
|
|
1143
|
+
<th>Method</th>
|
|
1144
|
+
<th>Description</th>
|
|
1145
|
+
</tr>
|
|
1146
|
+
</thead>
|
|
1147
|
+
<tbody>
|
|
1148
|
+
<tr>
|
|
1149
|
+
<td><code>g(pid)</code> / <code>h(pid)</code> / <code>d(pid)</code> / <code>c()</code></td>
|
|
1150
|
+
<td>Aliases for <code>get</code>, <code>has</code>, <code>delete</code>, and <code>clear</code></td>
|
|
1151
|
+
</tr>
|
|
1152
|
+
<tr>
|
|
1153
|
+
<td><code>f</code></td>
|
|
1154
|
+
<td>Alias for <code>forEach</code></td>
|
|
1155
|
+
</tr>
|
|
1156
|
+
<tr>
|
|
1157
|
+
<td><code>s(value, pid)</code></td>
|
|
1158
|
+
<td>Set a value for a PID</td>
|
|
1159
|
+
</tr>
|
|
1160
|
+
<tr>
|
|
1161
|
+
<td><code>mutate(pid, fn)</code></td>
|
|
1162
|
+
<td>Update an existing value in place using the current value</td>
|
|
1163
|
+
</tr>
|
|
1164
|
+
<tr>
|
|
1165
|
+
<td><code>swap(value, pid)</code></td>
|
|
1166
|
+
<td>Replace a value and return the previous value</td>
|
|
1167
|
+
</tr>
|
|
1168
|
+
<tr>
|
|
1169
|
+
<td><code>take(pid)</code></td>
|
|
1170
|
+
<td>Get and delete a value</td>
|
|
1171
|
+
</tr>
|
|
1172
|
+
<tr>
|
|
1173
|
+
<td><code>peek(pid)</code></td>
|
|
1174
|
+
<td>Return the value or <code>false</code> if absent</td>
|
|
1175
|
+
</tr>
|
|
1176
|
+
<tr>
|
|
1177
|
+
<td><code>getOrI(value, pid)</code></td>
|
|
1178
|
+
<td>Get or insert a supplied value</td>
|
|
1179
|
+
</tr>
|
|
1180
|
+
<tr>
|
|
1181
|
+
<td><code>getOrM(make, pid)</code></td>
|
|
1182
|
+
<td>Get or lazily create a value</td>
|
|
1183
|
+
</tr>
|
|
1184
|
+
<tr>
|
|
1185
|
+
<td><code>update(pid, fn, initial?)</code></td>
|
|
1186
|
+
<td>Update using the current value, or an initial value if missing</td>
|
|
1187
|
+
</tr>
|
|
1188
|
+
<tr>
|
|
1189
|
+
<td><code>setIfAbsent(value, pid)</code></td>
|
|
1190
|
+
<td>Insert only when missing</td>
|
|
1191
|
+
</tr>
|
|
1192
|
+
<tr>
|
|
1193
|
+
<td><code>setIfPresent(value, pid)</code></td>
|
|
1194
|
+
<td>Set only when present</td>
|
|
1195
|
+
</tr>
|
|
1196
|
+
<tr>
|
|
1197
|
+
<td><code>replace(value, pid)</code></td>
|
|
1198
|
+
<td>Replace only when present</td>
|
|
1199
|
+
</tr>
|
|
1200
|
+
<tr>
|
|
1201
|
+
<td><code>inc(pid, by?)</code></td>
|
|
1202
|
+
<td>Increment a numeric entry</td>
|
|
1203
|
+
</tr>
|
|
1204
|
+
<tr>
|
|
1205
|
+
<td><code>touch(pid)</code></td>
|
|
1206
|
+
<td>Ensure a PID exists</td>
|
|
1207
|
+
</tr>
|
|
1208
|
+
<tr>
|
|
1209
|
+
<td><code>mapValues(fn)</code> / <code>mapKeys(fn)</code></td>
|
|
1210
|
+
<td>Transform values or PIDs into a new map</td>
|
|
1211
|
+
</tr>
|
|
1212
|
+
<tr>
|
|
1213
|
+
<td><code>filterKV(pred)</code> / <code>filterKeys(pred)</code></td>
|
|
1214
|
+
<td>Filter in place</td>
|
|
1215
|
+
</tr>
|
|
1216
|
+
<tr>
|
|
1217
|
+
<td><code>partition(pred)</code></td>
|
|
1218
|
+
<td>Split entries into matching and nonmatching maps</td>
|
|
1219
|
+
</tr>
|
|
1220
|
+
<tr>
|
|
1221
|
+
<td><code>find(pred)</code></td>
|
|
1222
|
+
<td>Find the first matching entry</td>
|
|
1223
|
+
</tr>
|
|
1224
|
+
<tr>
|
|
1225
|
+
<td><code>findKey(pred)</code> / <code>findValue(pred)</code></td>
|
|
1226
|
+
<td>Find a matching PID or value</td>
|
|
1227
|
+
</tr>
|
|
1228
|
+
<tr>
|
|
1229
|
+
<td><code>some(pred)</code> / <code>every(pred)</code></td>
|
|
1230
|
+
<td>Predicate checks</td>
|
|
1231
|
+
</tr>
|
|
1232
|
+
<tr>
|
|
1233
|
+
<td><code>reduce(fn, initial)</code></td>
|
|
1234
|
+
<td>Reduce entries</td>
|
|
1235
|
+
</tr>
|
|
1236
|
+
<tr>
|
|
1237
|
+
<td><code>forEachKV(fn)</code></td>
|
|
1238
|
+
<td>Iterate over value, PID, and map</td>
|
|
1239
|
+
</tr>
|
|
1240
|
+
<tr>
|
|
1241
|
+
<td><code>invert()</code></td>
|
|
1242
|
+
<td>Reverse PIDs and values into a plain <code>Map</code></td>
|
|
1243
|
+
</tr>
|
|
1244
|
+
<tr>
|
|
1245
|
+
<td><code>group(fn)</code></td>
|
|
1246
|
+
<td>Group values by computed key, into a map of arrays</td>
|
|
1247
|
+
</tr>
|
|
1248
|
+
<tr>
|
|
1249
|
+
<td><code>unique(fn?)</code></td>
|
|
1250
|
+
<td>Deduplicate by computed or original value</td>
|
|
1251
|
+
</tr>
|
|
1252
|
+
<tr>
|
|
1253
|
+
<td><code>pick(pids)</code> / <code>omit(pids)</code></td>
|
|
1254
|
+
<td>Select or exclude PIDs</td>
|
|
1255
|
+
</tr>
|
|
1256
|
+
<tr>
|
|
1257
|
+
<td><code>merge(entries)</code></td>
|
|
1258
|
+
<td>Merge entries into the current map</td>
|
|
1259
|
+
</tr>
|
|
1260
|
+
<tr>
|
|
1261
|
+
<td><code>clearAndSet(entries)</code></td>
|
|
1262
|
+
<td>Replace all entries as a single batch</td>
|
|
1263
|
+
</tr>
|
|
1264
|
+
<tr>
|
|
1265
|
+
<td><code>toObject()</code></td>
|
|
1266
|
+
<td>Convert entries to an object</td>
|
|
1267
|
+
</tr>
|
|
1268
|
+
<tr>
|
|
1269
|
+
<td><code>toArray()</code> / <code>toKeys()</code> / <code>toValues()</code></td>
|
|
1270
|
+
<td>Convert entries, PIDs, or values to an array</td>
|
|
1271
|
+
</tr>
|
|
1272
|
+
<tr>
|
|
1273
|
+
<td><code>clone()</code></td>
|
|
1274
|
+
<td>Create a shallow copy</td>
|
|
1275
|
+
</tr>
|
|
1276
|
+
<tr>
|
|
1277
|
+
<td><code>equals(other)</code></td>
|
|
1278
|
+
<td>Compare PIDs and values by value-aware equality</td>
|
|
1279
|
+
</tr>
|
|
1280
|
+
<tr>
|
|
1281
|
+
<td><code>on(fn)</code></td>
|
|
1282
|
+
<td>Subscribe to change events; returns an unsubscribe function</td>
|
|
1283
|
+
</tr>
|
|
1284
|
+
<tr>
|
|
1285
|
+
<td><code>off(fn)</code></td>
|
|
1286
|
+
<td>Unsubscribe a listener</td>
|
|
1287
|
+
</tr>
|
|
1288
|
+
<tr>
|
|
1289
|
+
<td><code>batch(fn)</code></td>
|
|
1290
|
+
<td>Run multiple writes, coalescing into one event per PID</td>
|
|
1291
|
+
</tr>
|
|
1292
|
+
<tr>
|
|
1293
|
+
<td><code>dv(pid, deps, fn)</code></td>
|
|
1294
|
+
<td>Define a derived value computed from other PIDs</td>
|
|
1295
|
+
</tr>
|
|
1296
|
+
<tr>
|
|
1297
|
+
<td><code>dirty(...pids)</code></td>
|
|
1298
|
+
<td>Mark derived values as needing recomputation</td>
|
|
1299
|
+
</tr>
|
|
1300
|
+
<tr>
|
|
1301
|
+
<td><code>$debug(limit?)</code></td>
|
|
1302
|
+
<td>Enable event history tracking</td>
|
|
1303
|
+
</tr>
|
|
1304
|
+
<tr>
|
|
1305
|
+
<td><code>$strict()</code></td>
|
|
1306
|
+
<td>Throw if mutated while iterating</td>
|
|
1307
|
+
</tr>
|
|
1308
|
+
<tr>
|
|
1309
|
+
<td><code>$history()</code></td>
|
|
1310
|
+
<td>Return recorded change events</td>
|
|
1311
|
+
</tr>
|
|
1312
|
+
<tr>
|
|
1313
|
+
<td><code>$why(pid)</code></td>
|
|
1314
|
+
<td>Return the most recent event for a PID</td>
|
|
1315
|
+
</tr>
|
|
1316
|
+
<tr>
|
|
1317
|
+
<td><code>$diff(other)</code></td>
|
|
1318
|
+
<td>Compare against another map: added, deleted, and changed entries</td>
|
|
1319
|
+
</tr>
|
|
1320
|
+
<tr>
|
|
1321
|
+
<td><code>fromObject(obj, cap, stride?)</code></td>
|
|
1322
|
+
<td>Create a map from an object</td>
|
|
1323
|
+
</tr>
|
|
1324
|
+
<tr>
|
|
1325
|
+
<td><code>fromEntries(entries, cap, stride?)</code></td>
|
|
1326
|
+
<td>Create a map from entries</td>
|
|
1327
|
+
</tr>
|
|
1328
|
+
<tr>
|
|
1329
|
+
<td><code>from(map, cap, stride?)</code></td>
|
|
1330
|
+
<td>Create a map from another map</td>
|
|
1331
|
+
</tr>
|
|
1332
|
+
</tbody>
|
|
1333
|
+
</table>
|
|
1334
|
+
<p><code>cap</code>, <code>stride</code>, and <code>size</code> are exposed as readonly properties. <code>pidToSlot</code>, <code>slotToPid</code>, and <code>vals</code> are the backing arrays.</p>
|
|
822
1335
|
<h2 id="n2--number"><code>N2</code> — Number</h2>
|
|
823
1336
|
<p>Numeric helpers return <code>N2I</code> for chaining unless otherwise indicated.</p>
|
|
824
1337
|
<table>
|
|
@@ -1330,7 +1843,7 @@
|
|
|
1330
1843
|
</table>
|
|
1331
1844
|
<p>Also inherits the native <code>String</code> API. <code>S2</code> is registered as a callable and constructible string wrapper.</p>
|
|
1332
1845
|
<h2 id="set2--set"><code>SET2</code> — Set</h2>
|
|
1333
|
-
<p>
|
|
1846
|
+
<p><code>SET2</code> extends <code>Set</code> and retains the standard <code>Set</code> API, plus functional transforms, bulk mutation, set algebra, and conversion helpers. Like <code>M2</code>, keys are arbitrary — any value <code>Set</code> accepts, <code>SET2</code> accepts.</p>
|
|
1334
1847
|
<table>
|
|
1335
1848
|
<thead>
|
|
1336
1849
|
<tr>
|
|
@@ -1345,124 +1858,311 @@
|
|
|
1345
1858
|
</tr>
|
|
1346
1859
|
<tr>
|
|
1347
1860
|
<td><code>take(value)</code></td>
|
|
1348
|
-
<td>
|
|
1861
|
+
<td>Delete and return the value, or <code>undefined</code> if absent</td>
|
|
1349
1862
|
</tr>
|
|
1350
1863
|
<tr>
|
|
1351
1864
|
<td><code>peek(value)</code></td>
|
|
1352
|
-
<td>
|
|
1865
|
+
<td>Return the value or <code>false</code> if absent</td>
|
|
1353
1866
|
</tr>
|
|
1354
1867
|
<tr>
|
|
1355
1868
|
<td><code>toggle(value)</code></td>
|
|
1356
|
-
<td>
|
|
1869
|
+
<td>Add if absent, delete if present; returns the new membership</td>
|
|
1357
1870
|
</tr>
|
|
1358
1871
|
<tr>
|
|
1359
1872
|
<td><code>first()</code> / <code>last()</code></td>
|
|
1360
|
-
<td>
|
|
1873
|
+
<td>First or last value in iteration order</td>
|
|
1361
1874
|
</tr>
|
|
1362
1875
|
<tr>
|
|
1363
1876
|
<td><code>union(other)</code></td>
|
|
1364
|
-
<td>
|
|
1877
|
+
<td>New set of all values in either set</td>
|
|
1365
1878
|
</tr>
|
|
1366
1879
|
<tr>
|
|
1367
1880
|
<td><code>intersection(other)</code></td>
|
|
1368
|
-
<td>
|
|
1881
|
+
<td>New set of values in both sets</td>
|
|
1369
1882
|
</tr>
|
|
1370
1883
|
<tr>
|
|
1371
1884
|
<td><code>difference(other)</code></td>
|
|
1372
|
-
<td>
|
|
1885
|
+
<td>New set of values in this set but not the other</td>
|
|
1373
1886
|
</tr>
|
|
1374
1887
|
<tr>
|
|
1375
1888
|
<td><code>symmetricDifference(other)</code></td>
|
|
1376
|
-
<td>
|
|
1889
|
+
<td>New set of values in either set but not both</td>
|
|
1377
1890
|
</tr>
|
|
1378
1891
|
<tr>
|
|
1379
1892
|
<td><code>isSubsetOf(other)</code> / <code>isSupersetOf(other)</code></td>
|
|
1380
|
-
<td>
|
|
1893
|
+
<td>Containment checks</td>
|
|
1381
1894
|
</tr>
|
|
1382
1895
|
<tr>
|
|
1383
1896
|
<td><code>isDisjointFrom(other)</code></td>
|
|
1384
|
-
<td>
|
|
1897
|
+
<td>Whether the two sets share no values</td>
|
|
1385
1898
|
</tr>
|
|
1386
1899
|
<tr>
|
|
1387
1900
|
<td><code>equals(other)</code></td>
|
|
1388
|
-
<td>
|
|
1901
|
+
<td>Whether the two sets contain the same values</td>
|
|
1389
1902
|
</tr>
|
|
1390
1903
|
<tr>
|
|
1391
|
-
<td><code>filter(fn)</code
|
|
1392
|
-
<td>
|
|
1904
|
+
<td><code>filter(fn)</code></td>
|
|
1905
|
+
<td>New set of values matching the predicate</td>
|
|
1906
|
+
</tr>
|
|
1907
|
+
<tr>
|
|
1908
|
+
<td><code>map(fn)</code></td>
|
|
1909
|
+
<td>New set of mapped values</td>
|
|
1393
1910
|
</tr>
|
|
1394
1911
|
<tr>
|
|
1395
1912
|
<td><code>partition(fn)</code></td>
|
|
1396
|
-
<td>
|
|
1913
|
+
<td>Split into matching and nonmatching sets</td>
|
|
1397
1914
|
</tr>
|
|
1398
1915
|
<tr>
|
|
1399
1916
|
<td><code>differenceBy(other, fn)</code></td>
|
|
1400
|
-
<td>
|
|
1917
|
+
<td>Difference by computed key</td>
|
|
1401
1918
|
</tr>
|
|
1402
1919
|
<tr>
|
|
1403
1920
|
<td><code>uniqueBy(fn)</code></td>
|
|
1404
|
-
<td>
|
|
1921
|
+
<td>Deduplicate by computed key</td>
|
|
1405
1922
|
</tr>
|
|
1406
1923
|
<tr>
|
|
1407
1924
|
<td><code>find(fn)</code></td>
|
|
1408
|
-
<td>
|
|
1925
|
+
<td>First matching value, or <code>undefined</code></td>
|
|
1409
1926
|
</tr>
|
|
1410
1927
|
<tr>
|
|
1411
1928
|
<td><code>every(fn)</code> / <code>some(fn)</code></td>
|
|
1412
|
-
<td>
|
|
1929
|
+
<td>Predicate checks</td>
|
|
1413
1930
|
</tr>
|
|
1414
1931
|
<tr>
|
|
1415
1932
|
<td><code>reduce(fn, initial)</code></td>
|
|
1416
|
-
<td>
|
|
1933
|
+
<td>Reduce values</td>
|
|
1417
1934
|
</tr>
|
|
1418
1935
|
<tr>
|
|
1419
1936
|
<td><code>addAll(values)</code></td>
|
|
1420
|
-
<td>
|
|
1937
|
+
<td>Add many values</td>
|
|
1421
1938
|
</tr>
|
|
1422
1939
|
<tr>
|
|
1423
1940
|
<td><code>deleteAll(values)</code></td>
|
|
1424
|
-
<td>
|
|
1941
|
+
<td>Delete many values; returns the count removed</td>
|
|
1425
1942
|
</tr>
|
|
1426
1943
|
<tr>
|
|
1427
1944
|
<td><code>retainAll(values)</code></td>
|
|
1428
|
-
<td>
|
|
1945
|
+
<td>Delete every value not in <code>values</code></td>
|
|
1429
1946
|
</tr>
|
|
1430
1947
|
<tr>
|
|
1431
1948
|
<td><code>update(values)</code></td>
|
|
1432
|
-
<td>
|
|
1949
|
+
<td>Alias for <code>addAll</code></td>
|
|
1433
1950
|
</tr>
|
|
1434
1951
|
<tr>
|
|
1435
1952
|
<td><code>replace(values)</code></td>
|
|
1436
|
-
<td>
|
|
1953
|
+
<td>Clear, then add all values</td>
|
|
1437
1954
|
</tr>
|
|
1438
1955
|
<tr>
|
|
1439
1956
|
<td><code>swap(a, b)</code></td>
|
|
1440
|
-
<td>
|
|
1957
|
+
<td>If <code>a</code> is present, delete <code>a</code> and add <code>b</code></td>
|
|
1441
1958
|
</tr>
|
|
1442
1959
|
<tr>
|
|
1443
1960
|
<td><code>clone()</code></td>
|
|
1444
|
-
<td>
|
|
1961
|
+
<td>Create a shallow copy</td>
|
|
1445
1962
|
</tr>
|
|
1446
1963
|
<tr>
|
|
1447
1964
|
<td><code>toArray()</code></td>
|
|
1448
|
-
<td>
|
|
1965
|
+
<td>Convert to an array</td>
|
|
1449
1966
|
</tr>
|
|
1450
1967
|
<tr>
|
|
1451
1968
|
<td><code>toMap(fn)</code></td>
|
|
1452
|
-
<td>
|
|
1969
|
+
<td>Convert to an <code>M2</code>, using <code>fn</code> to produce <code>[key, value]</code> per entry</td>
|
|
1453
1970
|
</tr>
|
|
1454
1971
|
<tr>
|
|
1455
1972
|
<td><code>toObject(fn?)</code></td>
|
|
1456
|
-
<td>
|
|
1973
|
+
<td>Convert to an object, keyed by <code>fn(value)</code> or <code>String(value)</code></td>
|
|
1457
1974
|
</tr>
|
|
1458
1975
|
<tr>
|
|
1459
1976
|
<td><code>toJSON()</code></td>
|
|
1460
|
-
<td>
|
|
1977
|
+
<td>Alias for <code>toArray</code></td>
|
|
1978
|
+
</tr>
|
|
1979
|
+
<tr>
|
|
1980
|
+
<td><code>fromArray(values)</code></td>
|
|
1981
|
+
<td>Create a set from an array</td>
|
|
1982
|
+
</tr>
|
|
1983
|
+
<tr>
|
|
1984
|
+
<td><code>fromObject(obj)</code></td>
|
|
1985
|
+
<td>Create a set from an object's values</td>
|
|
1986
|
+
</tr>
|
|
1987
|
+
<tr>
|
|
1988
|
+
<td><code>fromEntries(entries)</code></td>
|
|
1989
|
+
<td>Create a set from the values of <code>[key, value]</code> pairs</td>
|
|
1990
|
+
</tr>
|
|
1991
|
+
<tr>
|
|
1992
|
+
<td><code>from(values)</code></td>
|
|
1993
|
+
<td>Create a set from any iterable</td>
|
|
1461
1994
|
</tr>
|
|
1462
1995
|
</tbody>
|
|
1463
1996
|
</table>
|
|
1464
|
-
<
|
|
1465
|
-
<
|
|
1997
|
+
<h2 id="set2b--set-binary"><code>SET2B</code> — Set Binary</h2>
|
|
1998
|
+
<p><code>SET2BI</code> is the dense, PID-indexed backing store for <code>SET2</code>. Membership lives in a <code>Uint8Array</code> (<code>flags[pid] → 0/1</code>), dense iteration walks <code>slots</code>, and <code>pidToIdx</code> gives O(1) delete via swap-remove. <code>cap</code> is the maximum PID; values outside <code>[0, cap)</code> read as absent.</p>
|
|
1999
|
+
<table>
|
|
2000
|
+
<thead>
|
|
2001
|
+
<tr>
|
|
2002
|
+
<th>Method</th>
|
|
2003
|
+
<th>Description</th>
|
|
2004
|
+
</tr>
|
|
2005
|
+
</thead>
|
|
2006
|
+
<tbody>
|
|
2007
|
+
<tr>
|
|
2008
|
+
<td><code>s(pid)</code></td>
|
|
2009
|
+
<td>Alias for <code>add</code></td>
|
|
2010
|
+
</tr>
|
|
2011
|
+
<tr>
|
|
2012
|
+
<td><code>add(pid)</code></td>
|
|
2013
|
+
<td>Add a PID</td>
|
|
2014
|
+
</tr>
|
|
2015
|
+
<tr>
|
|
2016
|
+
<td><code>has(pid)</code></td>
|
|
2017
|
+
<td>Whether the PID is a member</td>
|
|
2018
|
+
</tr>
|
|
2019
|
+
<tr>
|
|
2020
|
+
<td><code>delete(pid)</code></td>
|
|
2021
|
+
<td>Remove a PID; returns whether it was present</td>
|
|
2022
|
+
</tr>
|
|
2023
|
+
<tr>
|
|
2024
|
+
<td><code>clear()</code></td>
|
|
2025
|
+
<td>Remove every member in place</td>
|
|
2026
|
+
</tr>
|
|
2027
|
+
<tr>
|
|
2028
|
+
<td><code>take(pid)</code></td>
|
|
2029
|
+
<td>Delete and return the PID, or <code>undefined</code> if absent</td>
|
|
2030
|
+
</tr>
|
|
2031
|
+
<tr>
|
|
2032
|
+
<td><code>peek(pid)</code></td>
|
|
2033
|
+
<td>Return the PID or <code>false</code> if absent</td>
|
|
2034
|
+
</tr>
|
|
2035
|
+
<tr>
|
|
2036
|
+
<td><code>toggle(pid)</code></td>
|
|
2037
|
+
<td>Add if absent, delete if present; returns the new membership</td>
|
|
2038
|
+
</tr>
|
|
2039
|
+
<tr>
|
|
2040
|
+
<td><code>first()</code> / <code>last()</code></td>
|
|
2041
|
+
<td>First or last PID in dense order</td>
|
|
2042
|
+
</tr>
|
|
2043
|
+
<tr>
|
|
2044
|
+
<td><code>union(other)</code></td>
|
|
2045
|
+
<td>New set of all PIDs in either set</td>
|
|
2046
|
+
</tr>
|
|
2047
|
+
<tr>
|
|
2048
|
+
<td><code>intersection(other)</code></td>
|
|
2049
|
+
<td>New set of PIDs in both sets</td>
|
|
2050
|
+
</tr>
|
|
2051
|
+
<tr>
|
|
2052
|
+
<td><code>difference(other)</code></td>
|
|
2053
|
+
<td>New set of PIDs in this set but not the other</td>
|
|
2054
|
+
</tr>
|
|
2055
|
+
<tr>
|
|
2056
|
+
<td><code>symmetricDifference(other)</code></td>
|
|
2057
|
+
<td>New set of PIDs in either set but not both</td>
|
|
2058
|
+
</tr>
|
|
2059
|
+
<tr>
|
|
2060
|
+
<td><code>isSubsetOf(other)</code> / <code>isSupersetOf(other)</code></td>
|
|
2061
|
+
<td>Containment checks</td>
|
|
2062
|
+
</tr>
|
|
2063
|
+
<tr>
|
|
2064
|
+
<td><code>isDisjointFrom(other)</code></td>
|
|
2065
|
+
<td>Whether the two sets share no PIDs</td>
|
|
2066
|
+
</tr>
|
|
2067
|
+
<tr>
|
|
2068
|
+
<td><code>equals(other)</code></td>
|
|
2069
|
+
<td>Whether the two sets contain the same PIDs</td>
|
|
2070
|
+
</tr>
|
|
2071
|
+
<tr>
|
|
2072
|
+
<td><code>filter(fn)</code></td>
|
|
2073
|
+
<td>New set of PIDs matching the predicate</td>
|
|
2074
|
+
</tr>
|
|
2075
|
+
<tr>
|
|
2076
|
+
<td><code>map(fn)</code></td>
|
|
2077
|
+
<td>New set of mapped PIDs</td>
|
|
2078
|
+
</tr>
|
|
2079
|
+
<tr>
|
|
2080
|
+
<td><code>partition(fn)</code></td>
|
|
2081
|
+
<td>Split into matching and nonmatching sets</td>
|
|
2082
|
+
</tr>
|
|
2083
|
+
<tr>
|
|
2084
|
+
<td><code>differenceBy(other, fn)</code></td>
|
|
2085
|
+
<td>Difference by computed key</td>
|
|
2086
|
+
</tr>
|
|
2087
|
+
<tr>
|
|
2088
|
+
<td><code>uniqueBy(fn)</code></td>
|
|
2089
|
+
<td>Deduplicate by computed key</td>
|
|
2090
|
+
</tr>
|
|
2091
|
+
<tr>
|
|
2092
|
+
<td><code>find(fn)</code></td>
|
|
2093
|
+
<td>First matching PID, or <code>undefined</code></td>
|
|
2094
|
+
</tr>
|
|
2095
|
+
<tr>
|
|
2096
|
+
<td><code>every(fn)</code> / <code>some(fn)</code></td>
|
|
2097
|
+
<td>Predicate checks</td>
|
|
2098
|
+
</tr>
|
|
2099
|
+
<tr>
|
|
2100
|
+
<td><code>reduce(fn, initial)</code></td>
|
|
2101
|
+
<td>Reduce PIDs</td>
|
|
2102
|
+
</tr>
|
|
2103
|
+
<tr>
|
|
2104
|
+
<td><code>addAll(pids)</code></td>
|
|
2105
|
+
<td>Add many PIDs</td>
|
|
2106
|
+
</tr>
|
|
2107
|
+
<tr>
|
|
2108
|
+
<td><code>deleteAll(pids)</code></td>
|
|
2109
|
+
<td>Delete many PIDs; returns the count removed</td>
|
|
2110
|
+
</tr>
|
|
2111
|
+
<tr>
|
|
2112
|
+
<td><code>retainAll(pids)</code></td>
|
|
2113
|
+
<td>Delete every PID not in <code>pids</code></td>
|
|
2114
|
+
</tr>
|
|
2115
|
+
<tr>
|
|
2116
|
+
<td><code>update(pids)</code></td>
|
|
2117
|
+
<td>Alias for <code>addAll</code></td>
|
|
2118
|
+
</tr>
|
|
2119
|
+
<tr>
|
|
2120
|
+
<td><code>replace(pids)</code></td>
|
|
2121
|
+
<td>Clear, then add all PIDs</td>
|
|
2122
|
+
</tr>
|
|
2123
|
+
<tr>
|
|
2124
|
+
<td><code>swap(a, b)</code></td>
|
|
2125
|
+
<td>If <code>a</code> is present, delete <code>a</code> and add <code>b</code></td>
|
|
2126
|
+
</tr>
|
|
2127
|
+
<tr>
|
|
2128
|
+
<td><code>clone()</code></td>
|
|
2129
|
+
<td>Create a shallow copy</td>
|
|
2130
|
+
</tr>
|
|
2131
|
+
<tr>
|
|
2132
|
+
<td><code>toArray()</code></td>
|
|
2133
|
+
<td>Convert to an array of PIDs</td>
|
|
2134
|
+
</tr>
|
|
2135
|
+
<tr>
|
|
2136
|
+
<td><code>toMap(fn)</code></td>
|
|
2137
|
+
<td>Convert to a plain <code>Map</code>, using <code>fn</code> to produce <code>[key, value]</code> per PID</td>
|
|
2138
|
+
</tr>
|
|
2139
|
+
<tr>
|
|
2140
|
+
<td><code>toObject(fn?)</code></td>
|
|
2141
|
+
<td>Convert to an object, keyed by <code>fn(pid)</code> or <code>String(pid)</code></td>
|
|
2142
|
+
</tr>
|
|
2143
|
+
<tr>
|
|
2144
|
+
<td><code>toJSON()</code></td>
|
|
2145
|
+
<td>Alias for <code>toArray</code></td>
|
|
2146
|
+
</tr>
|
|
2147
|
+
<tr>
|
|
2148
|
+
<td><code>fromArray(pids, cap?)</code></td>
|
|
2149
|
+
<td>Create a set from an array of PIDs</td>
|
|
2150
|
+
</tr>
|
|
2151
|
+
<tr>
|
|
2152
|
+
<td><code>fromObject(obj, cap?)</code></td>
|
|
2153
|
+
<td>Create a set from an object's values</td>
|
|
2154
|
+
</tr>
|
|
2155
|
+
<tr>
|
|
2156
|
+
<td><code>fromEntries(entries, cap?)</code></td>
|
|
2157
|
+
<td>Create a set from the values of <code>[key, value]</code> pairs</td>
|
|
2158
|
+
</tr>
|
|
2159
|
+
<tr>
|
|
2160
|
+
<td><code>from(pids, cap?)</code></td>
|
|
2161
|
+
<td>Create a set from any iterable of PIDs</td>
|
|
2162
|
+
</tr>
|
|
2163
|
+
</tbody>
|
|
2164
|
+
</table>
|
|
2165
|
+
<h2 id="u82--uint8array"><code>U82</code> — Uint8Array</h2>
|
|
1466
2166
|
<p>Extends <code>Array<T></code> with collection access, transformations, set-like operations, and in-place utilities.</p>
|
|
1467
2167
|
<table>
|
|
1468
2168
|
<thead>
|
|
@@ -1904,8 +2604,10 @@ iterator.<span class="hljs-title function_">filter</span>(<span class="hljs-func
|
|
|
1904
2604
|
<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">"Something failed"</span>);
|
|
1905
2605
|
error.<span class="hljs-title function_">toJSON</span>();
|
|
1906
2606
|
</code></pre>
|
|
2607
|
+
</div>
|
|
2608
|
+
<div style="font-size: 9px; text-align: right">
|
|
1907
2609
|
|
|
1908
|
-
|
|
2610
|
+
<script async src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script>
|
|
1909
2611
|
|
|
1910
2612
|
</body>
|
|
1911
2613
|
</html>
|