You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Only named exports
- No more CJS, only ESM
- Adds auto-publish
- Adds dependabot
- Adds tests for abortable sink/source/duplex
- Removes support for multiple abort signals - just use `any-signal`
BREAKING CHANGE: switch to named exports, ESM only
**(alias for `abortable.source(source, signal, [options])`)**
73
73
74
74
Make any iterator or iterable abortable via an `AbortSignal`.
@@ -94,54 +94,20 @@ Make any iterator or iterable abortable via an `AbortSignal`.
94
94
95
95
The returned iterator will `throw` an `AbortError` when it is aborted that has a `type` with the value `aborted` and `code` property with the value `ABORT_ERR` by default.
96
96
97
-
### `abortable(source, signals)`
98
-
**(alias for `abortable.source(source, signals)`)**
99
-
100
-
Make any iterator or iterable abortable via any one of the passed `AbortSignal`'s.
101
-
102
-
#### Parameters
103
-
104
-
| Name | Type | Description |
105
-
|------|------|-------------|
106
-
| source |[`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol)\|[`Iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol)| The iterator or iterable object to make abortable |
107
-
| signals |`Array<{ signal, [options] }>`| An array of objects with `signal` and optional `options` properties. See above docs for expected values for these two properties. |
108
-
109
-
#### Returns
110
-
111
-
| Type | Description |
112
-
|------|-------------|
113
-
|[`Iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol)| An iterator that wraps the passed `source` parameter that makes it abortable via the passed `signal` parameters. |
114
-
115
-
The returned iterator will `throw` an `AbortError` when it is aborted on _any_ one of the passed abort signals. The error object has a `type` with the value `aborted` and `code` property with the value `ABORT_ERR` by default.
116
-
117
-
### `abortable.sink(sink, signal, [options])`
97
+
### `abortableSink(sink, signal, [options])`
118
98
119
99
The same as [`abortable.source`](#abortablesource-signal-options) except this makes the passed [`sink`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#sink-it) abortable. Returns a new sink that wraps the passed `sink` and makes it abortable via the passed `signal` parameter.
120
100
121
-
### `abortable.sink(sink, signals)`
122
-
123
-
The same as [`abortable.source`](#abortablesource-signals) except this makes the passed [`sink`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#sink-it) abortable via any one of the passed `AbortSignal`'s. Returns a new sink that wraps the passed `sink` and makes it abortable via the passed `signal` parameters.
The same as [`abortable.source`](#abortablesource-signal-options) except this makes the passed [`transform`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#transform-it) abortable. Returns a new transform that wraps the passed `transform` and makes it abortable via the passed `signal` parameter.
128
104
129
-
### `abortable.transform(transform, signals)`
130
-
131
-
The same as [`abortable.source`](#abortablesource-signals) except this makes the passed [`transform`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#transform-it) abortable via any one of the passed `AbortSignal`'s. Returns a new transform that wraps the passed `transform` and makes it abortable via the passed `signal` parameters.
132
-
133
-
### `abortable.duplex(duplex, signal, [options])`
105
+
### `abortableDuplex(duplex, signal, [options])`
134
106
135
107
The same as [`abortable.source`](#abortablesource-signal-options) except this makes the passed [`duplex`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it) abortable. Returns a new duplex that wraps the passed `duplex` and makes it abortable via the passed `signal` parameter.
136
108
137
109
Note that this will abort _both_ sides of the duplex. Use `duplex.sink = abortable.sink(duplex.sink)` or `duplex.source = abortable.source(duplex.source)` to abort just the sink or the source.
138
110
139
-
### `abortable.duplex(duplex, signals)`
140
-
141
-
The same as [`abortable.source`](#abortablesource-signals) except this makes the passed [`duplex`](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it) abortable via any one of the passed `AbortSignal`'s. Returns a new duplex that wraps the passed `duplex` and makes it abortable via the passed `signal` parameters.
142
-
143
-
Note that this will abort _both_ sides of the duplex. Use `duplex.sink = abortable.sink(duplex.sink)` or `duplex.source = abortable.source(duplex.source)` to abort just the sink or the source.
144
-
145
111
## Related
146
112
147
113
*[`it-pipe`](https://www.npmjs.com/package/it-pipe) Utility to "pipe" async iterables together
0 commit comments