1 | import { AsyncIterableX } from './asynciterablex';
|
2 | export class FinallyAsyncIterable extends AsyncIterableX {
|
3 | constructor(source, action) {
|
4 | super();
|
5 | this._source = source;
|
6 | this._action = action;
|
7 | }
|
8 | async *[Symbol.asyncIterator]() {
|
9 | try {
|
10 | for await (let item of this._source) {
|
11 | yield item;
|
12 | }
|
13 | }
|
14 | finally {
|
15 | await this._action();
|
16 | }
|
17 | }
|
18 | }
|
19 | export function _finally(source, action) {
|
20 | return new FinallyAsyncIterable(source, action);
|
21 | }
|
22 |
|
23 | //# sourceMappingURL=finally.mjs.map
|