Commit 1d87f8e
committed
feat!: reconcile abort-signal with type-safety and efficiency refactors
Layers minimal refactors on top of the abort-signal feature commits:
- Add normalizeError helper (lib/misc.js) and use it in all 5 fillQueue /
fail-fast catch sites
- Extract isValueObject helper in lib/type-checks.js (DRY for isIterable /
isAsyncIterable)
- Add bounds check to ordered-insertion while loop in fillQueue so the
BufferPromise type cast is honest past array end
- Inline null-safety on the IteratorResult shape check
(`!result || typeof result !== 'object'`); typeof null === 'object' would
have let null through to the next-line property accesses
Drops the larger-scope tweaks from the harden / efficiency branches that
weren't earning their keep:
- @voxpelli/typed-utils runtime dep (kept the lib zero-dep; the only
material correctness win — null check on IteratorResult — is inlined)
- yieldArrayWithItem generator (replaces a 1-element array allocation in
the common case with a generator allocation; not a measurable win and
less readable than the spread)
- guardedArrayIncludes (the type cast in isPartOfArray is honest enough)
BREAKING CHANGE: engine requirement bumped from >=18.6.0 to >=22.0.0 (native
Symbol.asyncDispose is required). Callback signature widened from
`(item)` to `(item, { signal })`; existing one-arg callbacks keep working
since JS ignores extra args, but TypeScript consumers that pass a callback
type with a strict single-parameter signature may need to update the type.1 parent 11fbb41 commit 1d87f8e
3 files changed
Lines changed: 26 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
1 | 7 | | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
5 | | - | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
11 | | - | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
0 commit comments