iter-fest 0.1.1-main.4decbaa → 0.1.1-main.7bda6b5

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.
Files changed (45) hide show
  1. package/README.md +1 -77
  2. package/dist/{chunk-4LRYDU2Y.mjs → chunk-QDUX45ZP.mjs} +6 -4
  3. package/dist/chunk-QDUX45ZP.mjs.map +1 -0
  4. package/dist/iter-fest.d.mts +0 -4
  5. package/dist/iter-fest.d.ts +0 -4
  6. package/dist/iter-fest.js +6 -104
  7. package/dist/iter-fest.js.map +1 -1
  8. package/dist/iter-fest.mjs +4 -21
  9. package/dist/iter-fest.observableValues.mjs +1 -2
  10. package/package.json +2 -42
  11. package/dist/chunk-2HLJODU3.mjs +0 -21
  12. package/dist/chunk-2HLJODU3.mjs.map +0 -1
  13. package/dist/chunk-4LRYDU2Y.mjs.map +0 -1
  14. package/dist/chunk-EIIP7YWB.mjs +0 -27
  15. package/dist/chunk-EIIP7YWB.mjs.map +0 -1
  16. package/dist/chunk-FEOLYD5R.mjs +0 -31
  17. package/dist/chunk-FEOLYD5R.mjs.map +0 -1
  18. package/dist/chunk-K5XV4W7G.mjs +0 -35
  19. package/dist/chunk-K5XV4W7G.mjs.map +0 -1
  20. package/dist/chunk-U6G4RNZ2.mjs +0 -10
  21. package/dist/chunk-U6G4RNZ2.mjs.map +0 -1
  22. package/dist/iter-fest.observableFromAsync.d.mts +0 -7
  23. package/dist/iter-fest.observableFromAsync.d.ts +0 -7
  24. package/dist/iter-fest.observableFromAsync.js +0 -91
  25. package/dist/iter-fest.observableFromAsync.js.map +0 -1
  26. package/dist/iter-fest.observableFromAsync.mjs +0 -9
  27. package/dist/iter-fest.observableFromAsync.mjs.map +0 -1
  28. package/dist/iter-fest.observableSubscribeAsReadable.d.mts +0 -7
  29. package/dist/iter-fest.observableSubscribeAsReadable.d.ts +0 -7
  30. package/dist/iter-fest.observableSubscribeAsReadable.js +0 -51
  31. package/dist/iter-fest.observableSubscribeAsReadable.js.map +0 -1
  32. package/dist/iter-fest.observableSubscribeAsReadable.mjs +0 -7
  33. package/dist/iter-fest.observableSubscribeAsReadable.mjs.map +0 -1
  34. package/dist/iter-fest.pushAsyncIterableIterator.d.mts +0 -9
  35. package/dist/iter-fest.pushAsyncIterableIterator.d.ts +0 -9
  36. package/dist/iter-fest.pushAsyncIterableIterator.js +0 -73
  37. package/dist/iter-fest.pushAsyncIterableIterator.js.map +0 -1
  38. package/dist/iter-fest.pushAsyncIterableIterator.mjs +0 -8
  39. package/dist/iter-fest.pushAsyncIterableIterator.mjs.map +0 -1
  40. package/dist/iter-fest.readerToAsyncIterableIterator.d.mts +0 -3
  41. package/dist/iter-fest.readerToAsyncIterableIterator.d.ts +0 -3
  42. package/dist/iter-fest.readerToAsyncIterableIterator.js +0 -45
  43. package/dist/iter-fest.readerToAsyncIterableIterator.js.map +0 -1
  44. package/dist/iter-fest.readerToAsyncIterableIterator.mjs +0 -7
  45. package/dist/iter-fest.readerToAsyncIterableIterator.mjs.map +0 -1
package/README.md CHANGED
@@ -61,7 +61,7 @@ for (const value of iteratorToIterable(iterate())) {
61
61
 
62
62
  `Observable` and `Symbol.observable` is re-exported from `core-js-pure` with proper type definitions.
63
63
 
64
- ### Converting an `Observable` to `AsyncIterableIterator`
64
+ ### Converting an `Observable` to `AsyncIterable`
65
65
 
66
66
  `observableValues` subscribes to an `Observable` and return as `AsyncIterableIterator`.
67
67
 
@@ -75,82 +75,6 @@ for await (const value of observableValues(observable)) {
75
75
  }
76
76
  ```
77
77
 
78
- ### Converting an `AsyncIterable` to `Observable`
79
-
80
- `Observable.from` converts `Iterable` into `Observable`. However, it does not convert `AsyncIterable`.
81
-
82
- `observableFromAsync` will convert `AsyncIterable` into `Observable`.
83
-
84
- ```ts
85
- async function* generate() {
86
- yield 1;
87
- yield 2;
88
- yield 3;
89
- }
90
-
91
- const observable = observableFromAsync(generate());
92
- const next = value => console.log(value);
93
-
94
- observable.subscribe({ next }); // Prints "1", "2", "3".
95
- ```
96
-
97
- ### Producer-consumer queue
98
-
99
- `PushAsyncIterableIterator` is a simple push-based producer-consumer queue. The producer can push a new job at anytime. The consumer will wait for jobs to be available.
100
-
101
- A push-based queue is easier to use than a pull-based queue. However, pull-based queue offers better flow control. For a full-featured producer-consumer queue that supports flow control, use `ReadableStream` instead.
102
-
103
- ```ts
104
- const iterable = new PushAsyncIterableIterator();
105
-
106
- (async function consumer() {
107
- for await (const value of iterable) {
108
- console.log(value);
109
- }
110
-
111
- console.log('Done');
112
- })();
113
-
114
- (async function producer() {
115
- iterable.push(1);
116
- iterable.push(2);
117
- iterable.push(3);
118
- iterable.close();
119
- })();
120
-
121
- // Prints "1", "2", "3", "Done".
122
- ```
123
-
124
- ### Iterating `ReadableStreamDefaultReader`
125
-
126
- `readerToAsyncIterableIterator` will convert default reader of `ReadableStream` into an `AsyncIterableIterator` to use in for-loop.
127
-
128
- ```ts
129
- const readableStream = new ReadableStream({
130
- start(controller) {
131
- controller.enqueue(1);
132
- controller.enqueue(2);
133
- controller.close();
134
- }
135
- });
136
-
137
- for await (const value of readerToAsyncIterableIterator(readableStream.getReader())) {
138
- console.log(value); // Prints "1", "2", "3".
139
- }
140
- ```
141
-
142
- ## Converts `Observable` into `ReadableStream`
143
-
144
- `ReadableStream` is powerful for transforming and piping stream of data. It can be formed using data from both push-based and pull-based source with backpressuree.
145
-
146
- ```ts
147
- const observable = Observable.from([1, 2, 3]);
148
- const readable = observableSubscribeAsReadable(observable);
149
- const reader = readable.getReader();
150
-
151
- readable.pipeTo(stream.writable); // Will write 1, 2, 3.
152
- ```
153
-
154
78
  ## Behaviors
155
79
 
156
80
  ### How this compares to the TC39 proposals?
@@ -1,6 +1,8 @@
1
- import {
2
- withResolvers
3
- } from "./chunk-U6G4RNZ2.mjs";
1
+ // src/private/withResolvers.ts
2
+ import coreJSPromiseWithResolvers from "core-js-pure/full/promise/with-resolvers";
3
+ function withResolvers() {
4
+ return coreJSPromiseWithResolvers();
5
+ }
4
6
 
5
7
  // src/observableValues.ts
6
8
  var COMPLETE = Symbol("complete");
@@ -59,4 +61,4 @@ function observableValues(observable) {
59
61
  export {
60
62
  observableValues
61
63
  };
62
- //# sourceMappingURL=chunk-4LRYDU2Y.mjs.map
64
+ //# sourceMappingURL=chunk-QDUX45ZP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/private/withResolvers.ts","../src/observableValues.ts"],"sourcesContent":["// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n","import withResolvers from './private/withResolvers';\n\nimport { Observable } from './Observable';\n\nconst COMPLETE = Symbol('complete');\nconst NEXT = Symbol('next');\nconst THROW = Symbol('throw');\n\ntype Entry<T> = [typeof COMPLETE] | [typeof NEXT, T] | [typeof THROW, unknown];\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n const queue: Entry<T>[] = [];\n let deferred = withResolvers<Entry<T>>();\n\n const push = (entry: Entry<T>) => {\n queue.push(entry);\n deferred.resolve(entry);\n deferred = withResolvers();\n };\n\n const subscription = observable.subscribe({\n complete() {\n push([COMPLETE]);\n },\n error(err: unknown) {\n push([THROW, err]);\n },\n next(value: T) {\n push([NEXT, value]);\n }\n });\n\n const asyncIterableIterator: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return this;\n },\n async next(): Promise<IteratorResult<T>> {\n let entry = queue.shift();\n\n if (!entry) {\n entry = await deferred.promise;\n queue.shift();\n }\n\n switch (entry[0]) {\n case COMPLETE:\n return { done: true, value: undefined };\n\n case THROW:\n throw entry[1];\n\n case NEXT:\n return { done: false, value: entry[1] };\n }\n },\n async return() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n },\n async throw() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n }\n };\n\n return asyncIterableIterator;\n}\n"],"mappings":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A,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,5 +1,4 @@
1
1
  export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.mjs';
2
- export { PushAsyncIterableIterator } from './iter-fest.pushAsyncIterableIterator.mjs';
3
2
  export { SymbolObservable } from './iter-fest.symbolObservable.mjs';
4
3
  export { iterableAt } from './iter-fest.iterableAt.mjs';
5
4
  export { iterableConcat } from './iter-fest.iterableConcat.mjs';
@@ -22,8 +21,5 @@ export { iterableSome } from './iter-fest.iterableSome.mjs';
22
21
  export { iterableToSpliced } from './iter-fest.iterableToSpliced.mjs';
23
22
  export { iterableToString } from './iter-fest.iterableToString.mjs';
24
23
  export { iteratorToIterable } from './iter-fest.iteratorToIterable.mjs';
25
- export { observableFromAsync } from './iter-fest.observableFromAsync.mjs';
26
- export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.mjs';
27
24
  export { observableValues } from './iter-fest.observableValues.mjs';
28
- export { readerToAsyncIterableIterator } from './iter-fest.readerToAsyncIterableIterator.mjs';
29
25
  import 'core-js-pure/full/observable';
@@ -1,5 +1,4 @@
1
1
  export { CompleteFunction, ErrorFunction, NextFunction, Observable, Observer, StartFunction, SubscriberFunction, Subscription, SubscriptionObserver } from './iter-fest.observable.js';
2
- export { PushAsyncIterableIterator } from './iter-fest.pushAsyncIterableIterator.js';
3
2
  export { SymbolObservable } from './iter-fest.symbolObservable.js';
4
3
  export { iterableAt } from './iter-fest.iterableAt.js';
5
4
  export { iterableConcat } from './iter-fest.iterableConcat.js';
@@ -22,8 +21,5 @@ export { iterableSome } from './iter-fest.iterableSome.js';
22
21
  export { iterableToSpliced } from './iter-fest.iterableToSpliced.js';
23
22
  export { iterableToString } from './iter-fest.iterableToString.js';
24
23
  export { iteratorToIterable } from './iter-fest.iteratorToIterable.js';
25
- export { observableFromAsync } from './iter-fest.observableFromAsync.js';
26
- export { observableSubscribeAsReadable } from './iter-fest.observableSubscribeAsReadable.js';
27
24
  export { observableValues } from './iter-fest.observableValues.js';
28
- export { readerToAsyncIterableIterator } from './iter-fest.readerToAsyncIterableIterator.js';
29
25
  import 'core-js-pure/full/observable';
package/dist/iter-fest.js CHANGED
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Observable: () => Observable,
34
- PushAsyncIterableIterator: () => PushAsyncIterableIterator,
35
34
  SymbolObservable: () => SymbolObservable,
36
35
  iterableAt: () => iterableAt,
37
36
  iterableConcat: () => iterableConcat,
@@ -54,10 +53,7 @@ __export(src_exports, {
54
53
  iterableToSpliced: () => iterableToSpliced,
55
54
  iterableToString: () => iterableToString,
56
55
  iteratorToIterable: () => iteratorToIterable,
57
- observableFromAsync: () => observableFromAsync,
58
- observableSubscribeAsReadable: () => observableSubscribeAsReadable,
59
- observableValues: () => observableValues,
60
- readerToAsyncIterableIterator: () => readerToAsyncIterableIterator
56
+ observableValues: () => observableValues
61
57
  });
62
58
  module.exports = __toCommonJS(src_exports);
63
59
 
@@ -89,39 +85,6 @@ var Observable = class extends import_observable2.default {
89
85
  }
90
86
  };
91
87
 
92
- // src/private/withResolvers.ts
93
- var import_with_resolvers = __toESM(require("core-js-pure/full/promise/with-resolvers"));
94
- function withResolvers() {
95
- return (0, import_with_resolvers.default)();
96
- }
97
-
98
- // src/PushAsyncIterableIterator.ts
99
- var CLOSE = Symbol("close");
100
- var PushAsyncIterableIterator = class {
101
- #closed = false;
102
- #pushResolvers = withResolvers();
103
- [Symbol.asyncIterator]() {
104
- return this;
105
- }
106
- close() {
107
- this.#closed = true;
108
- this.#pushResolvers.resolve(CLOSE);
109
- }
110
- async next() {
111
- const value = await this.#pushResolvers.promise;
112
- if (value === CLOSE) {
113
- return { done: true, value: void 0 };
114
- }
115
- return { done: false, value };
116
- }
117
- push(value) {
118
- if (!this.#closed) {
119
- this.#pushResolvers.resolve(value);
120
- this.#pushResolvers = withResolvers();
121
- }
122
- }
123
- };
124
-
125
88
  // src/private/toIntegerOrInfinity.ts
126
89
  function toIntegerOrInfinity(value) {
127
90
  if (value === Infinity || value === -Infinity) {
@@ -440,50 +403,10 @@ function iteratorToIterable(iterator) {
440
403
  return iterableIterator;
441
404
  }
442
405
 
443
- // src/observableFromAsync.ts
444
- function observableFromAsync(iterable) {
445
- return new Observable((subscriber) => {
446
- let closed = false;
447
- (async function() {
448
- try {
449
- for await (const value of iterable) {
450
- if (closed) {
451
- break;
452
- }
453
- subscriber.next(value);
454
- }
455
- subscriber.complete();
456
- } catch (error) {
457
- subscriber.error(error);
458
- }
459
- })();
460
- return () => {
461
- closed = true;
462
- };
463
- });
464
- }
465
-
466
- // src/observableSubscribeAsReadable.ts
467
- function observableSubscribeAsReadable(observable) {
468
- let subscription;
469
- return new ReadableStream({
470
- cancel() {
471
- subscription.unsubscribe();
472
- },
473
- start(controller) {
474
- subscription = observable.subscribe({
475
- complete() {
476
- controller.close();
477
- },
478
- error(err) {
479
- controller.error(err);
480
- },
481
- next(value) {
482
- controller.enqueue(value);
483
- }
484
- });
485
- }
486
- });
406
+ // src/private/withResolvers.ts
407
+ var import_with_resolvers = __toESM(require("core-js-pure/full/promise/with-resolvers"));
408
+ function withResolvers() {
409
+ return (0, import_with_resolvers.default)();
487
410
  }
488
411
 
489
412
  // src/observableValues.ts
@@ -539,27 +462,9 @@ function observableValues(observable) {
539
462
  };
540
463
  return asyncIterableIterator;
541
464
  }
542
-
543
- // src/readerToAsyncIterableIterator.ts
544
- function readerToAsyncIterableIterator(reader) {
545
- const iterable = {
546
- [Symbol.asyncIterator]() {
547
- return iterable;
548
- },
549
- async next() {
550
- const result = await Promise.race([reader.read(), reader.closed]);
551
- if (!result || result.done) {
552
- return { done: true, value: void 0 };
553
- }
554
- return { value: result.value };
555
- }
556
- };
557
- return iterable;
558
- }
559
465
  // Annotate the CommonJS export names for ESM import in node:
560
466
  0 && (module.exports = {
561
467
  Observable,
562
- PushAsyncIterableIterator,
563
468
  SymbolObservable,
564
469
  iterableAt,
565
470
  iterableConcat,
@@ -582,9 +487,6 @@ function readerToAsyncIterableIterator(reader) {
582
487
  iterableToSpliced,
583
488
  iterableToString,
584
489
  iteratorToIterable,
585
- observableFromAsync,
586
- observableSubscribeAsReadable,
587
- observableValues,
588
- readerToAsyncIterableIterator
490
+ observableValues
589
491
  });
590
492
  //# sourceMappingURL=iter-fest.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Observable.ts","../src/SymbolObservable.ts","../src/private/withResolvers.ts","../src/PushAsyncIterableIterator.ts","../src/private/toIntegerOrInfinity.ts","../src/iterableAt.ts","../src/iterableConcat.ts","../src/iterableEntries.ts","../src/iterableEvery.ts","../src/iterableFilter.ts","../src/iterableFind.ts","../src/iterableFindIndex.ts","../src/iterableFindLast.ts","../src/iterableFindLastIndex.ts","../src/iterableForEach.ts","../src/iterableIncludes.ts","../src/iterableIndexOf.ts","../src/iterableJoin.ts","../src/iterableKeys.ts","../src/iterableMap.ts","../src/iterableReduce.ts","../src/iterableSlice.ts","../src/iterableSome.ts","../src/iterableToSpliced.ts","../src/iterableToString.ts","../src/iteratorToIterable.ts","../src/observableFromAsync.ts","../src/observableSubscribeAsReadable.ts","../src/observableValues.ts","../src/readerToAsyncIterableIterator.ts"],"sourcesContent":["export * from './Observable';\nexport * from './PushAsyncIterableIterator';\nexport * from './SymbolObservable';\nexport * from './iterableAt';\nexport * from './iterableConcat';\nexport * from './iterableEntries';\nexport * from './iterableEvery';\nexport * from './iterableFilter';\nexport * from './iterableFind';\nexport * from './iterableFindIndex';\nexport * from './iterableFindLast';\nexport * from './iterableFindLastIndex';\nexport * from './iterableForEach';\nexport * from './iterableIncludes';\nexport * from './iterableIndexOf';\nexport * from './iterableJoin';\nexport * from './iterableKeys';\nexport * from './iterableMap';\nexport * from './iterableReduce';\nexport * from './iterableSlice';\nexport * from './iterableSome';\nexport * from './iterableToSpliced';\nexport * from './iterableToString';\nexport * from './iteratorToIterable';\nexport * from './observableFromAsync';\nexport * from './observableSubscribeAsReadable';\nexport * from './observableValues';\nexport * from './readerToAsyncIterableIterator';\n","// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable';\n\nimport { SymbolObservable } from './SymbolObservable';\n\nexport interface SubscriptionObserver<T> {\n /** Sends the next value in the sequence */\n next(value: T): void;\n\n /** Sends the sequence error */\n error(errorValue: unknown): void;\n\n /** Sends the completion notification */\n complete(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport interface Subscription {\n /** Cancels the subscription */\n unsubscribe(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport type SubscriberFunction<T> = (observer: SubscriptionObserver<T>) => (() => void) | Subscription | void;\n\nexport type CompleteFunction = () => void;\nexport type ErrorFunction = (errorValue: unknown) => void;\nexport type NextFunction<T> = (value: T) => void;\nexport type StartFunction = (subscription: Subscription) => void;\n\nexport interface Observer<T> {\n /** Receives a completion notification */\n complete?(): void;\n\n /** Receives the sequence error */\n error?(errorValue: unknown): void;\n\n /** Receives the next value in the sequence */\n next?(value: T): void;\n\n /** Receives the subscription object when `subscribe` is called */\n start?(subscription: Subscription): void;\n}\n\nexport class Observable<T> extends CoreJSObservable {\n constructor(subscriber: SubscriberFunction<T>) {\n super(subscriber);\n }\n\n /** Subscribes to the sequence with an observer */\n subscribe(observer: Observer<T>): Subscription;\n\n /** Subscribes to the sequence with callbacks */\n subscribe(\n onNext: NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription;\n\n subscribe(\n observerOrOnNext: Observer<T> | NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription {\n return super.subscribe(observerOrOnNext, onError, onComplete);\n }\n\n /** Returns itself */\n [SymbolObservable](): Observable<T> {\n return this;\n }\n\n /** Converts items to an Observable */\n static of<T>(...items: T[]): Observable<T> {\n return CoreJSObservable.of(...items);\n }\n\n /** Converts an iterable to an Observable */\n static from<T>(iterable: Iterable<T>): Observable<T>;\n\n /** Converts an observable to an Observable */\n static from<T>(observable: Observable<T>): Observable<T>;\n\n static from<T>(iterableOrObservable: Iterable<T> | Observable<T>): Observable<T> {\n return CoreJSObservable.from(iterableOrObservable);\n }\n}\n","// @ts-expect-error core-js is not typed.\nimport CoreJSSymbolObservable from 'core-js-pure/features/symbol/observable';\n\nconst SymbolObservable: unique symbol = CoreJSSymbolObservable;\n\nexport { SymbolObservable };\n","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n","import withResolvers from './private/withResolvers';\n\nconst CLOSE = Symbol('close');\n\nexport class PushAsyncIterableIterator<T> implements AsyncIterableIterator<T> {\n #closed: boolean = false;\n #pushResolvers: PromiseWithResolvers<T | typeof CLOSE> = withResolvers();\n\n [Symbol.asyncIterator]() {\n return this;\n }\n\n close() {\n this.#closed = true;\n this.#pushResolvers.resolve(CLOSE);\n }\n\n async next(): Promise<IteratorResult<T>> {\n const value = await this.#pushResolvers.promise;\n\n if (value === CLOSE) {\n return { done: true, value: undefined };\n }\n\n return { done: false, value };\n }\n\n push(value: T) {\n if (!this.#closed) {\n this.#pushResolvers.resolve(value);\n this.#pushResolvers = withResolvers();\n }\n }\n}\n","export default function toIntegerOrInfinity(value: number): number {\n if (value === Infinity || value === -Infinity) {\n return value;\n }\n\n return ~~value;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns the item located at the specified index.\n *\n * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.\n */\nexport function iterableAt<T>(iterable: Iterable<T>, index: number): T | undefined {\n let currentIndex = 0;\n\n index = toIntegerOrInfinity(index);\n\n if (!isFinite(index)) {\n return;\n }\n\n if (index < 0) {\n throw new TypeError('index cannot be a negative finite number');\n }\n\n for (const value of iterable) {\n if (currentIndex++ === index) {\n return value;\n }\n }\n\n return undefined;\n}\n","/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: Iterable<T>[]): IterableIterator<T>;\n\n/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T>;\n\nexport function* iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T> {\n yield* iterable;\n\n for (const item of items) {\n if (item && typeof item === 'object' && Symbol.iterator in item) {\n yield* item;\n } else {\n yield item;\n }\n }\n}\n","/**\n * Returns an iterable of key, value pairs for every entry in the iterable\n */\nexport function* iterableEntries<T>(iterable: Iterable<T>): IterableIterator<[number, T]> {\n let index = 0;\n\n for (const value of iterable) {\n yield [index++, value];\n }\n}\n","/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): iterable is S[];\n\n/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): boolean;\n\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (!boundPredicate(value, index++, iterable)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Returns the elements of an iterable that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterable.\n * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableFilter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: unknown\n): IterableIterator<S>;\n\n/**\n * Returns the elements of an iterable that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterable.\n * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableFilter<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): IterableIterator<T>;\n\nexport function* iterableFilter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: unknown\n): IterableIterator<S> {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n yield value as S;\n }\n }\n}\n","/**\n * Returns the value of the first element in the iterable where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterable, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFind<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iterableFind<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iterableFind<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n return value as S;\n }\n }\n\n return undefined;\n}\n","/**\n * Returns the index of the first element in the iterable where predicate is true, and -1\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterable, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindIndex<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index, iterable)) {\n return index;\n }\n\n index++;\n }\n\n return -1;\n}\n","/**\n * Returns the value of the last element in the iterable where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate findLast calls predicate once for each element of the iterable, in descending\n * order, until it finds one where predicate returns true. If such an element is found, findLast\n * immediately returns that element value. Otherwise, findLast returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindLast<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iterableFindLast<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iterableFindLast<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n let last: S | undefined;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n last = value as S;\n }\n }\n\n return last;\n}\n","/**\n * Returns the index of the last element in the iterable where predicate is true, and -1\n * otherwise.\n *\n * @param predicate findLastIndex calls predicate once for each element of the iterable, in descending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindLastIndex<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n let lastIndex: number = -1;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index, iterable)) {\n lastIndex = index;\n }\n\n index++;\n }\n\n return lastIndex;\n}\n","/**\n * Performs the specified action for each element in an iterable.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableForEach<T>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, iterable: Iterable<T>) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): void {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n const boundCallbackfn = callbackfn.bind(thisArg);\n\n for (const value of iterable) {\n boundCallbackfn(value, index++, iterable);\n }\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Determines whether an iterable includes a certain element, returning true or false as appropriate.\n *\n * @param searchElement The element to search for.\n * @param fromIndex The position in this iterable at which to begin searching for searchElement.\n */\nexport function iterableIncludes<T>(iterable: Iterable<T>, searchElement: T, fromIndex: number = 0): boolean {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iterable) {\n if (index++ >= fromIndex && Object.is(item, searchElement)) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns the index of the first occurrence of a value in an iterable, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the iterable.\n * @param fromIndex The iterable index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport function iterableIndexOf<T>(iterable: Iterable<T>, searchElement: T, fromIndex: number = 0): number {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iterable) {\n if (index >= fromIndex && Object.is(item, searchElement)) {\n return index;\n }\n\n index++;\n }\n }\n\n return -1;\n}\n","/**\n * Adds all the elements of an iterable into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the iterable from the next in the resulting string. If omitted, the iterable elements are separated with a comma.\n */\nexport function iterableJoin<T>(iterable: Iterable<T>, separator: string = ','): string {\n let index = 0;\n let result = '';\n\n for (const item of iterable) {\n if (index) {\n result += separator;\n }\n\n if (typeof item !== 'undefined' && item !== null) {\n result += item;\n }\n\n index++;\n }\n\n return result;\n}\n","/**\n * Returns an iterable of keys in the iterable\n */\nexport function* iterableKeys<T>(iterable: Iterable<T>): IterableIterator<number> {\n let index = 0;\n\n for (const _ of iterable) {\n yield index++;\n }\n}\n","/**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function* iterableMap<T, U>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, array: Iterable<T>) => U,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): IterableIterator<U> {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n for (const value of iterable) {\n yield callbackfn.call(thisArg, value, index++, iterable);\n }\n}\n","/**\n * Calls the specified callback function for all the elements in an iterable. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterable.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterable value.\n */\nexport function iterableReduce<T>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number, iterable: Iterable<T>) => T\n): T;\n\nexport function iterableReduce<T>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number, iterable: Iterable<T>) => T,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterable. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterable.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n\nexport function iterableReduce<T, U>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number, iterable: Iterable<T>) => U,\n initialValue: U\n): U;\n\nexport function iterableReduce<T, U = undefined>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number, iterable: Iterable<T>) => U,\n initialValue?: U\n): U | undefined {\n let index = 0;\n let previousValue: U | undefined = initialValue;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n for (const currentValue of iterable) {\n previousValue = callbackfn(previousValue, currentValue, index++, iterable);\n }\n\n return previousValue;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns a copy of a section of an iterable.\n * For both start and end, a negative index can be used to indicate an offset from the end of the iterable.\n * For example, -2 refers to the second to last element of the iterable.\n *\n * @param start The beginning index of the specified portion of the iterable.\n * If start is undefined, then the slice begins at index 0.\n *\n * @param end The end index of the specified portion of the iterable. This is exclusive of the element at the index 'end'.\n * If end is undefined, then the slice extends to the end of the iterable.\n */\nexport function* iterableSlice<T>(iterable: Iterable<T>, start: number = 0, end: number = Infinity): Iterable<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n end = toIntegerOrInfinity(end);\n end = end === -Infinity ? 0 : end;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n if (end < 0) {\n throw new TypeError('end cannot be a negative finite number');\n }\n\n if (start === Infinity) {\n return;\n }\n\n for (const item of iterable) {\n if (index >= start && index < end) {\n yield item;\n }\n\n index++;\n\n if (index > end) {\n break;\n }\n }\n}\n","/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate\n * A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @param thisArg\n * An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableSome<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n return true;\n }\n }\n\n return false;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the copied array in place of the deleted elements.\n * @returns The copied array.\n */\nexport function iterableToSpliced<T>(\n iterable: Iterable<T>,\n start?: number | undefined,\n deleteCount?: number | undefined,\n ...items: T[]\n): Iterable<T>;\n\n/**\n * Copies an array and removes elements while returning the remaining elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns A copy of the original array with the remaining elements.\n */\nexport function iterableToSpliced<T>(\n iterable: Iterable<T>,\n start?: number | undefined,\n deleteCount?: number | undefined\n): Iterable<T>;\n\nexport function* iterableToSpliced<T>(\n iterable: Iterable<T>,\n start: number = 0,\n deleteCount: number = 0,\n ...items: T[]\n): Iterable<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n let inserted = false;\n\n for (const item of iterable) {\n if (index + 1 > start && !inserted) {\n yield* items;\n inserted = true;\n }\n\n if (index < start || index >= start + deleteCount) {\n yield item;\n }\n\n index++;\n }\n\n if (!inserted) {\n yield* items;\n }\n}\n","import { iterableJoin } from './iterableJoin';\n\n/**\n * Returns a string representation of an iterable.\n */\nexport function iterableToString<T>(iterable: Iterable<T>): string {\n return iterableJoin(iterable);\n}\n","export function iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T> {\n const iterableIterator: IterableIterator<T> = {\n [Symbol.iterator]: () => iterableIterator,\n next: iterator.next.bind(iterator),\n ...(iterator.return ? { return: iterator.return.bind(iterator) } : {}),\n ...(iterator.throw ? { throw: iterator.throw.bind(iterator) } : {})\n };\n\n return iterableIterator;\n}\n","import { Observable } from './Observable';\n\nexport function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T> {\n return new Observable(subscriber => {\n let closed = false;\n\n (async function () {\n try {\n for await (const value of iterable) {\n if (closed) {\n break;\n }\n\n subscriber.next(value);\n }\n\n subscriber.complete();\n } catch (error) {\n subscriber.error(error);\n }\n })();\n\n return () => {\n closed = true;\n };\n });\n}\n","import type { Observable, Subscription } from './Observable';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n","import withResolvers from './private/withResolvers';\n\nimport { Observable } from './Observable';\n\nconst COMPLETE = Symbol('complete');\nconst NEXT = Symbol('next');\nconst THROW = Symbol('throw');\n\ntype Entry<T> = [typeof COMPLETE] | [typeof NEXT, T] | [typeof THROW, unknown];\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n const queue: Entry<T>[] = [];\n let deferred = withResolvers<Entry<T>>();\n\n const push = (entry: Entry<T>) => {\n queue.push(entry);\n deferred.resolve(entry);\n deferred = withResolvers();\n };\n\n const subscription = observable.subscribe({\n complete() {\n push([COMPLETE]);\n },\n error(err: unknown) {\n push([THROW, err]);\n },\n next(value: T) {\n push([NEXT, value]);\n }\n });\n\n const asyncIterableIterator: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return this;\n },\n async next(): Promise<IteratorResult<T>> {\n let entry = queue.shift();\n\n if (!entry) {\n entry = await deferred.promise;\n queue.shift();\n }\n\n switch (entry[0]) {\n case COMPLETE:\n return { done: true, value: undefined };\n\n case THROW:\n throw entry[1];\n\n case NEXT:\n return { done: false, value: entry[1] };\n }\n },\n async return() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n },\n async throw() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n }\n };\n\n return asyncIterableIterator;\n}\n","export function readerToAsyncIterableIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T> {\n const iterable = {\n [Symbol.asyncIterator]() {\n return iterable;\n },\n async next(): Promise<IteratorResult<T>> {\n const result = await Promise.race([reader.read(), reader.closed]);\n\n if (!result || result.done) {\n return { done: true, value: undefined };\n }\n\n return { value: result.value };\n }\n };\n\n return iterable;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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AAO;AACT;","names":["import_observable","CoreJSSymbolObservable","CoreJSObservable","coreJSPromiseWithResolvers"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Observable.ts","../src/SymbolObservable.ts","../src/private/toIntegerOrInfinity.ts","../src/iterableAt.ts","../src/iterableConcat.ts","../src/iterableEntries.ts","../src/iterableEvery.ts","../src/iterableFilter.ts","../src/iterableFind.ts","../src/iterableFindIndex.ts","../src/iterableFindLast.ts","../src/iterableFindLastIndex.ts","../src/iterableForEach.ts","../src/iterableIncludes.ts","../src/iterableIndexOf.ts","../src/iterableJoin.ts","../src/iterableKeys.ts","../src/iterableMap.ts","../src/iterableReduce.ts","../src/iterableSlice.ts","../src/iterableSome.ts","../src/iterableToSpliced.ts","../src/iterableToString.ts","../src/iteratorToIterable.ts","../src/private/withResolvers.ts","../src/observableValues.ts"],"sourcesContent":["export * from './Observable';\nexport * from './SymbolObservable';\nexport * from './iterableAt';\nexport * from './iterableConcat';\nexport * from './iterableEntries';\nexport * from './iterableEvery';\nexport * from './iterableFilter';\nexport * from './iterableFind';\nexport * from './iterableFindIndex';\nexport * from './iterableFindLast';\nexport * from './iterableFindLastIndex';\nexport * from './iterableForEach';\nexport * from './iterableIncludes';\nexport * from './iterableIndexOf';\nexport * from './iterableJoin';\nexport * from './iterableKeys';\nexport * from './iterableMap';\nexport * from './iterableReduce';\nexport * from './iterableSlice';\nexport * from './iterableSome';\nexport * from './iterableToSpliced';\nexport * from './iterableToString';\nexport * from './iteratorToIterable';\nexport * from './observableValues';\n","// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable';\n\nimport { SymbolObservable } from './SymbolObservable';\n\nexport interface SubscriptionObserver<T> {\n /** Sends the next value in the sequence */\n next(value: T): void;\n\n /** Sends the sequence error */\n error(errorValue: unknown): void;\n\n /** Sends the completion notification */\n complete(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport interface Subscription {\n /** Cancels the subscription */\n unsubscribe(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport type SubscriberFunction<T> = (observer: SubscriptionObserver<T>) => (() => void) | Subscription | void;\n\nexport type CompleteFunction = () => void;\nexport type ErrorFunction = (errorValue: unknown) => void;\nexport type NextFunction<T> = (value: T) => void;\nexport type StartFunction = (subscription: Subscription) => void;\n\nexport interface Observer<T> {\n /** Receives a completion notification */\n complete?(): void;\n\n /** Receives the sequence error */\n error?(errorValue: unknown): void;\n\n /** Receives the next value in the sequence */\n next?(value: T): void;\n\n /** Receives the subscription object when `subscribe` is called */\n start?(subscription: Subscription): void;\n}\n\nexport class Observable<T> extends CoreJSObservable {\n constructor(subscriber: SubscriberFunction<T>) {\n super(subscriber);\n }\n\n /** Subscribes to the sequence with an observer */\n subscribe(observer: Observer<T>): Subscription;\n\n /** Subscribes to the sequence with callbacks */\n subscribe(\n onNext: NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription;\n\n subscribe(\n observerOrOnNext: Observer<T> | NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription {\n return super.subscribe(observerOrOnNext, onError, onComplete);\n }\n\n /** Returns itself */\n [SymbolObservable](): Observable<T> {\n return this;\n }\n\n /** Converts items to an Observable */\n static of<T>(...items: T[]): Observable<T> {\n return CoreJSObservable.of(...items);\n }\n\n /** Converts an iterable to an Observable */\n static from<T>(iterable: Iterable<T>): Observable<T>;\n\n /** Converts an observable to an Observable */\n static from<T>(observable: Observable<T>): Observable<T>;\n\n static from<T>(iterableOrObservable: Iterable<T> | Observable<T>): Observable<T> {\n return CoreJSObservable.from(iterableOrObservable);\n }\n}\n","// @ts-expect-error core-js is not typed.\nimport CoreJSSymbolObservable from 'core-js-pure/features/symbol/observable';\n\nconst SymbolObservable: unique symbol = CoreJSSymbolObservable;\n\nexport { SymbolObservable };\n","export default function toIntegerOrInfinity(value: number): number {\n if (value === Infinity || value === -Infinity) {\n return value;\n }\n\n return ~~value;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns the item located at the specified index.\n *\n * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.\n */\nexport function iterableAt<T>(iterable: Iterable<T>, index: number): T | undefined {\n let currentIndex = 0;\n\n index = toIntegerOrInfinity(index);\n\n if (!isFinite(index)) {\n return;\n }\n\n if (index < 0) {\n throw new TypeError('index cannot be a negative finite number');\n }\n\n for (const value of iterable) {\n if (currentIndex++ === index) {\n return value;\n }\n }\n\n return undefined;\n}\n","/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: Iterable<T>[]): IterableIterator<T>;\n\n/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T>;\n\nexport function* iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T> {\n yield* iterable;\n\n for (const item of items) {\n if (item && typeof item === 'object' && Symbol.iterator in item) {\n yield* item;\n } else {\n yield item;\n }\n }\n}\n","/**\n * Returns an iterable of key, value pairs for every entry in the iterable\n */\nexport function* iterableEntries<T>(iterable: Iterable<T>): IterableIterator<[number, T]> {\n let index = 0;\n\n for (const value of iterable) {\n yield [index++, value];\n }\n}\n","/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): iterable is S[];\n\n/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): boolean;\n\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (!boundPredicate(value, index++, iterable)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Returns the elements of an iterable that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterable.\n * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableFilter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: unknown\n): IterableIterator<S>;\n\n/**\n * Returns the elements of an iterable that meet the condition specified in a callback function.\n *\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the iterable.\n * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableFilter<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): IterableIterator<T>;\n\nexport function* iterableFilter<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: unknown\n): IterableIterator<S> {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n yield value as S;\n }\n }\n}\n","/**\n * Returns the value of the first element in the iterable where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterable, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFind<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iterableFind<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iterableFind<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n return value as S;\n }\n }\n\n return undefined;\n}\n","/**\n * Returns the index of the first element in the iterable where predicate is true, and -1\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterable, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindIndex<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index, iterable)) {\n return index;\n }\n\n index++;\n }\n\n return -1;\n}\n","/**\n * Returns the value of the last element in the iterable where predicate is true, and undefined\n * otherwise.\n *\n * @param predicate findLast calls predicate once for each element of the iterable, in descending\n * order, until it finds one where predicate returns true. If such an element is found, findLast\n * immediately returns that element value. Otherwise, findLast returns undefined.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindLast<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined;\n\nexport function iterableFindLast<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): T | undefined;\n\nexport function iterableFindLast<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): S | undefined {\n let index = 0;\n let last: S | undefined;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n last = value as S;\n }\n }\n\n return last;\n}\n","/**\n * Returns the index of the last element in the iterable where predicate is true, and -1\n * otherwise.\n *\n * @param predicate findLastIndex calls predicate once for each element of the iterable, in descending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindLastIndex<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n let lastIndex: number = -1;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index, iterable)) {\n lastIndex = index;\n }\n\n index++;\n }\n\n return lastIndex;\n}\n","/**\n * Performs the specified action for each element in an iterable.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableForEach<T>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, iterable: Iterable<T>) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): void {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n const boundCallbackfn = callbackfn.bind(thisArg);\n\n for (const value of iterable) {\n boundCallbackfn(value, index++, iterable);\n }\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Determines whether an iterable includes a certain element, returning true or false as appropriate.\n *\n * @param searchElement The element to search for.\n * @param fromIndex The position in this iterable at which to begin searching for searchElement.\n */\nexport function iterableIncludes<T>(iterable: Iterable<T>, searchElement: T, fromIndex: number = 0): boolean {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iterable) {\n if (index++ >= fromIndex && Object.is(item, searchElement)) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns the index of the first occurrence of a value in an iterable, or -1 if it is not present.\n *\n * @param searchElement The value to locate in the iterable.\n * @param fromIndex The iterable index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport function iterableIndexOf<T>(iterable: Iterable<T>, searchElement: T, fromIndex: number = 0): number {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iterable) {\n if (index >= fromIndex && Object.is(item, searchElement)) {\n return index;\n }\n\n index++;\n }\n }\n\n return -1;\n}\n","/**\n * Adds all the elements of an iterable into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the iterable from the next in the resulting string. If omitted, the iterable elements are separated with a comma.\n */\nexport function iterableJoin<T>(iterable: Iterable<T>, separator: string = ','): string {\n let index = 0;\n let result = '';\n\n for (const item of iterable) {\n if (index) {\n result += separator;\n }\n\n if (typeof item !== 'undefined' && item !== null) {\n result += item;\n }\n\n index++;\n }\n\n return result;\n}\n","/**\n * Returns an iterable of keys in the iterable\n */\nexport function* iterableKeys<T>(iterable: Iterable<T>): IterableIterator<number> {\n let index = 0;\n\n for (const _ of iterable) {\n yield index++;\n }\n}\n","/**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function* iterableMap<T, U>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, array: Iterable<T>) => U,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): IterableIterator<U> {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n for (const value of iterable) {\n yield callbackfn.call(thisArg, value, index++, iterable);\n }\n}\n","/**\n * Calls the specified callback function for all the elements in an iterable. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterable.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an iterable value.\n */\nexport function iterableReduce<T>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number, iterable: Iterable<T>) => T\n): T;\n\nexport function iterableReduce<T>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: T, currentValue: T, currentIndex: number, iterable: Iterable<T>) => T,\n initialValue: T\n): T;\n\n/**\n * Calls the specified callback function for all the elements in an iterable. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n *\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the iterable.\n *\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n\nexport function iterableReduce<T, U>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: U, currentValue: T, currentIndex: number, iterable: Iterable<T>) => U,\n initialValue: U\n): U;\n\nexport function iterableReduce<T, U = undefined>(\n iterable: Iterable<T>,\n callbackfn: (previousValue: U | undefined, currentValue: T, currentIndex: number, iterable: Iterable<T>) => U,\n initialValue?: U\n): U | undefined {\n let index = 0;\n let previousValue: U | undefined = initialValue;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n for (const currentValue of iterable) {\n previousValue = callbackfn(previousValue, currentValue, index++, iterable);\n }\n\n return previousValue;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns a copy of a section of an iterable.\n * For both start and end, a negative index can be used to indicate an offset from the end of the iterable.\n * For example, -2 refers to the second to last element of the iterable.\n *\n * @param start The beginning index of the specified portion of the iterable.\n * If start is undefined, then the slice begins at index 0.\n *\n * @param end The end index of the specified portion of the iterable. This is exclusive of the element at the index 'end'.\n * If end is undefined, then the slice extends to the end of the iterable.\n */\nexport function* iterableSlice<T>(iterable: Iterable<T>, start: number = 0, end: number = Infinity): Iterable<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n end = toIntegerOrInfinity(end);\n end = end === -Infinity ? 0 : end;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n if (end < 0) {\n throw new TypeError('end cannot be a negative finite number');\n }\n\n if (start === Infinity) {\n return;\n }\n\n for (const item of iterable) {\n if (index >= start && index < end) {\n yield item;\n }\n\n index++;\n\n if (index > end) {\n break;\n }\n }\n}\n","/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate\n * A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @param thisArg\n * An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableSome<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n return true;\n }\n }\n\n return false;\n}\n","import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the copied array in place of the deleted elements.\n * @returns The copied array.\n */\nexport function iterableToSpliced<T>(\n iterable: Iterable<T>,\n start?: number | undefined,\n deleteCount?: number | undefined,\n ...items: T[]\n): Iterable<T>;\n\n/**\n * Copies an array and removes elements while returning the remaining elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns A copy of the original array with the remaining elements.\n */\nexport function iterableToSpliced<T>(\n iterable: Iterable<T>,\n start?: number | undefined,\n deleteCount?: number | undefined\n): Iterable<T>;\n\nexport function* iterableToSpliced<T>(\n iterable: Iterable<T>,\n start: number = 0,\n deleteCount: number = 0,\n ...items: T[]\n): Iterable<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n let inserted = false;\n\n for (const item of iterable) {\n if (index + 1 > start && !inserted) {\n yield* items;\n inserted = true;\n }\n\n if (index < start || index >= start + deleteCount) {\n yield item;\n }\n\n index++;\n }\n\n if (!inserted) {\n yield* items;\n }\n}\n","import { iterableJoin } from './iterableJoin';\n\n/**\n * Returns a string representation of an iterable.\n */\nexport function iterableToString<T>(iterable: Iterable<T>): string {\n return iterableJoin(iterable);\n}\n","export function iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T> {\n const iterableIterator: IterableIterator<T> = {\n [Symbol.iterator]: () => iterableIterator,\n next: iterator.next.bind(iterator),\n ...(iterator.return ? { return: iterator.return.bind(iterator) } : {}),\n ...(iterator.throw ? { throw: iterator.throw.bind(iterator) } : {})\n };\n\n return iterableIterator;\n}\n","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n","import withResolvers from './private/withResolvers';\n\nimport { Observable } from './Observable';\n\nconst COMPLETE = Symbol('complete');\nconst NEXT = Symbol('next');\nconst THROW = Symbol('throw');\n\ntype Entry<T> = [typeof COMPLETE] | [typeof NEXT, T] | [typeof THROW, unknown];\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n const queue: Entry<T>[] = [];\n let deferred = withResolvers<Entry<T>>();\n\n const push = (entry: Entry<T>) => {\n queue.push(entry);\n deferred.resolve(entry);\n deferred = withResolvers();\n };\n\n const subscription = observable.subscribe({\n complete() {\n push([COMPLETE]);\n },\n error(err: unknown) {\n push([THROW, err]);\n },\n next(value: T) {\n push([NEXT, value]);\n }\n });\n\n const asyncIterableIterator: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return this;\n },\n async next(): Promise<IteratorResult<T>> {\n let entry = queue.shift();\n\n if (!entry) {\n entry = await deferred.promise;\n queue.shift();\n }\n\n switch (entry[0]) {\n case COMPLETE:\n return { done: true, value: undefined };\n\n case THROW:\n throw entry[1];\n\n case NEXT:\n return { done: false, value: entry[1] };\n }\n },\n async return() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n },\n async throw() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n }\n };\n\n return asyncIterableIterator;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,qBAA6B;;;ACA7B,wBAAmC;AAEnC,IAAM,mBAAkC,kBAAAC;;;AD6CjC,IAAM,aAAN,cAA4B,mBAAAC,QAAiB;AAAA,EAClD,YAAY,YAAmC;AAC7C,UAAM,UAAU;AAAA,E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EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,QAExC,KAAK;AACH,gBAAM,MAAM,CAAC;AAAA,QAEf,KAAK;AACH,iBAAO,EAAE,MAAM,OAAO,OAAO,MAAM,CAAC,EAAE;AAAA,MAC1C;AAAA,IACF;AAAA,IACA,MAAM,SAAS;AACb,mBAAa,YAAY;AAEzB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAAA,IACA,MAAM,QAAQ;AACZ,mBAAa,YAAY;AAEzB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":["import_observable","CoreJSSymbolObservable","CoreJSObservable","coreJSPromiseWithResolvers"]}
@@ -1,16 +1,3 @@
1
- import {
2
- observableSubscribeAsReadable
3
- } from "./chunk-EIIP7YWB.mjs";
4
- import {
5
- observableValues
6
- } from "./chunk-4LRYDU2Y.mjs";
7
- import {
8
- PushAsyncIterableIterator
9
- } from "./chunk-K5XV4W7G.mjs";
10
- import "./chunk-U6G4RNZ2.mjs";
11
- import {
12
- readerToAsyncIterableIterator
13
- } from "./chunk-2HLJODU3.mjs";
14
1
  import {
15
2
  iterableReduce
16
3
  } from "./chunk-XW34KZRY.mjs";
@@ -29,15 +16,15 @@ import {
29
16
  import {
30
17
  iteratorToIterable
31
18
  } from "./chunk-MNDAEMYM.mjs";
32
- import {
33
- observableFromAsync
34
- } from "./chunk-FEOLYD5R.mjs";
35
19
  import {
36
20
  Observable
37
21
  } from "./chunk-VLF6DI2U.mjs";
38
22
  import {
39
23
  SymbolObservable
40
24
  } from "./chunk-OJMT4K3R.mjs";
25
+ import {
26
+ observableValues
27
+ } from "./chunk-QDUX45ZP.mjs";
41
28
  import {
42
29
  iterableFindLast
43
30
  } from "./chunk-V6OWQQ3Q.mjs";
@@ -86,7 +73,6 @@ import {
86
73
  } from "./chunk-HYU4EN7J.mjs";
87
74
  export {
88
75
  Observable,
89
- PushAsyncIterableIterator,
90
76
  SymbolObservable,
91
77
  iterableAt,
92
78
  iterableConcat,
@@ -109,9 +95,6 @@ export {
109
95
  iterableToSpliced,
110
96
  iterableToString,
111
97
  iteratorToIterable,
112
- observableFromAsync,
113
- observableSubscribeAsReadable,
114
- observableValues,
115
- readerToAsyncIterableIterator
98
+ observableValues
116
99
  };
117
100
  //# sourceMappingURL=iter-fest.mjs.map
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  observableValues
3
- } from "./chunk-4LRYDU2Y.mjs";
4
- import "./chunk-U6G4RNZ2.mjs";
3
+ } from "./chunk-QDUX45ZP.mjs";
5
4
  export {
6
5
  observableValues
7
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iter-fest",
3
- "version": "0.1.1-main.4decbaa",
3
+ "version": "0.1.1-main.7bda6b5",
4
4
  "description": "A collection of utilities for iterations.",
5
5
  "files": [
6
6
  "./dist/"
@@ -226,26 +226,6 @@
226
226
  "default": "./dist/iter-fest.observable.js"
227
227
  }
228
228
  },
229
- "./observableSubscribeAsReadable": {
230
- "import": {
231
- "types": "./dist/iter-fest.observableSubscribeAsReadable.d.mts",
232
- "default": "./dist/iter-fest.observableSubscribeAsReadable.mjs"
233
- },
234
- "require": {
235
- "types": "./dist/iter-fest.observableSubscribeAsReadable.d.ts",
236
- "default": "./dist/iter-fest.observableSubscribeAsReadable.js"
237
- }
238
- },
239
- "./observableFromAsync": {
240
- "import": {
241
- "types": "./dist/iter-fest.observableFromAsync.d.mts",
242
- "default": "./dist/iter-fest.observableFromAsync.mjs"
243
- },
244
- "require": {
245
- "types": "./dist/iter-fest.observableFromAsync.d.ts",
246
- "default": "./dist/iter-fest.observableFromAsync.js"
247
- }
248
- },
249
229
  "./observableValues": {
250
230
  "import": {
251
231
  "types": "./dist/iter-fest.observableValues.d.mts",
@@ -256,26 +236,6 @@
256
236
  "default": "./dist/iter-fest.observableValues.js"
257
237
  }
258
238
  },
259
- "./pushAsyncIterableIterator": {
260
- "import": {
261
- "types": "./dist/iter-fest.pushAsyncIterableIterator.d.mts",
262
- "default": "./dist/iter-fest.pushAsyncIterableIterator.mjs"
263
- },
264
- "require": {
265
- "types": "./dist/iter-fest.pushAsyncIterableIterator.d.ts",
266
- "default": "./dist/iter-fest.pushAsyncIterableIterator.js"
267
- }
268
- },
269
- "./readerToAsyncIterableIterator": {
270
- "import": {
271
- "types": "./dist/iter-fest.readerToAsyncIterableIterator.d.mts",
272
- "default": "./dist/iter-fest.readerToAsyncIterableIterator.mjs"
273
- },
274
- "require": {
275
- "types": "./dist/iter-fest.readerToAsyncIterableIterator.d.ts",
276
- "default": "./dist/iter-fest.readerToAsyncIterableIterator.js"
277
- }
278
- },
279
239
  "./symbolObservable": {
280
240
  "import": {
281
241
  "types": "./dist/iter-fest.symbolObservable.d.mts",
@@ -348,6 +308,6 @@
348
308
  "typescript": "^5.4.5"
349
309
  },
350
310
  "dependencies": {
351
- "iter-fest": "^0.1.1-main.4decbaa"
311
+ "iter-fest": "^0.1.1-main.7bda6b5"
352
312
  }
353
313
  }
@@ -1,21 +0,0 @@
1
- // src/readerToAsyncIterableIterator.ts
2
- function readerToAsyncIterableIterator(reader) {
3
- const iterable = {
4
- [Symbol.asyncIterator]() {
5
- return iterable;
6
- },
7
- async next() {
8
- const result = await Promise.race([reader.read(), reader.closed]);
9
- if (!result || result.done) {
10
- return { done: true, value: void 0 };
11
- }
12
- return { value: result.value };
13
- }
14
- };
15
- return iterable;
16
- }
17
-
18
- export {
19
- readerToAsyncIterableIterator
20
- };
21
- //# sourceMappingURL=chunk-2HLJODU3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/readerToAsyncIterableIterator.ts"],"sourcesContent":["export function readerToAsyncIterableIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T> {\n const iterable = {\n [Symbol.asyncIterator]() {\n return iterable;\n },\n async next(): Promise<IteratorResult<T>> {\n const result = await Promise.race([reader.read(), reader.closed]);\n\n if (!result || result.done) {\n return { done: true, value: undefined };\n }\n\n return { value: result.value };\n }\n };\n\n return iterable;\n}\n"],"mappings":";AAAO,SAAS,8BAAiC,QAAkE;AACjH,QAAM,WAAW;AAAA,IACf,CAAC,OAAO,aAAa,IAAI;AACvB,aAAO;AAAA,IACT;AAAA,IACA,MAAM,OAAmC;AACvC,YAAM,SAAS,MAAM,QAAQ,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,MAAM,CAAC;AAEhE,UAAI,CAAC,UAAU,OAAO,MAAM;AAC1B,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAEA,aAAO,EAAE,OAAO,OAAO,MAAM;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observableValues.ts"],"sourcesContent":["import withResolvers from './private/withResolvers';\n\nimport { Observable } from './Observable';\n\nconst COMPLETE = Symbol('complete');\nconst NEXT = Symbol('next');\nconst THROW = Symbol('throw');\n\ntype Entry<T> = [typeof COMPLETE] | [typeof NEXT, T] | [typeof THROW, unknown];\n\nexport function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T> {\n const queue: Entry<T>[] = [];\n let deferred = withResolvers<Entry<T>>();\n\n const push = (entry: Entry<T>) => {\n queue.push(entry);\n deferred.resolve(entry);\n deferred = withResolvers();\n };\n\n const subscription = observable.subscribe({\n complete() {\n push([COMPLETE]);\n },\n error(err: unknown) {\n push([THROW, err]);\n },\n next(value: T) {\n push([NEXT, value]);\n }\n });\n\n const asyncIterableIterator: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return this;\n },\n async next(): Promise<IteratorResult<T>> {\n let entry = queue.shift();\n\n if (!entry) {\n entry = await deferred.promise;\n queue.shift();\n }\n\n switch (entry[0]) {\n case COMPLETE:\n return { done: true, value: undefined };\n\n case THROW:\n throw entry[1];\n\n case NEXT:\n return { done: false, value: entry[1] };\n }\n },\n async return() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n },\n async throw() {\n subscription.unsubscribe();\n\n return { done: true, value: undefined };\n }\n };\n\n return asyncIterableIterator;\n}\n"],"mappings":";;;;;AAIA,IAAM,WAAW,OAAO,UAAU;AAClC,IAAM,OAAO,OAAO,MAAM;AAC1B,IAAM,QAAQ,OAAO,OAAO;AAIrB,SAAS,iBAAoB,YAAqD;AACvF,QAAM,QAAoB,CAAC;AAC3B,MAAI,WAAW,cAAwB;AAEvC,QAAM,OAAO,CAAC,UAAoB;AAChC,UAAM,KAAK,KAAK;AAChB,aAAS,QAAQ,KAAK;AACtB,eAAW,cAAc;AAAA,EAC3B;AAEA,QAAM,eAAe,WAAW,UAAU;AAAA,IACxC,WAAW;AACT,WAAK,CAAC,QAAQ,CAAC;AAAA,IACjB;AAAA,IACA,MAAM,KAAc;AAClB,WAAK,CAAC,OAAO,GAAG,CAAC;AAAA,IACnB;AAAA,IACA,KAAK,OAAU;AACb,WAAK,CAAC,MAAM,KAAK,CAAC;AAAA,IACpB;AAAA,EACF,CAAC;AAED,QAAM,wBAAkD;AAAA,IACtD,CAAC,OAAO,aAAa,IAAI;AACvB,aAAO;AAAA,IACT;AAAA,IACA,MAAM,OAAmC;AACvC,UAAI,QAAQ,MAAM,MAAM;AAExB,UAAI,CAAC,OAAO;AACV,gBAAQ,MAAM,SAAS;AACvB,cAAM,MAAM;AAAA,MACd;AAEA,cAAQ,MAAM,CAAC,GAAG;AAAA,QAChB,KAAK;AACH,iBAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,QAExC,KAAK;AACH,gBAAM,MAAM,CAAC;AAAA,QAEf,KAAK;AACH,iBAAO,EAAE,MAAM,OAAO,OAAO,MAAM,CAAC,EAAE;AAAA,MAC1C;AAAA,IACF;AAAA,IACA,MAAM,SAAS;AACb,mBAAa,YAAY;AAEzB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAAA,IACA,MAAM,QAAQ;AACZ,mBAAa,YAAY;AAEzB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,27 +0,0 @@
1
- // src/observableSubscribeAsReadable.ts
2
- function observableSubscribeAsReadable(observable) {
3
- let subscription;
4
- return new ReadableStream({
5
- cancel() {
6
- subscription.unsubscribe();
7
- },
8
- start(controller) {
9
- subscription = observable.subscribe({
10
- complete() {
11
- controller.close();
12
- },
13
- error(err) {
14
- controller.error(err);
15
- },
16
- next(value) {
17
- controller.enqueue(value);
18
- }
19
- });
20
- }
21
- });
22
- }
23
-
24
- export {
25
- observableSubscribeAsReadable
26
- };
27
- //# sourceMappingURL=chunk-EIIP7YWB.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observableSubscribeAsReadable.ts"],"sourcesContent":["import type { Observable, Subscription } from './Observable';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n"],"mappings":";AAEO,SAAS,8BAAiC,YAA8C;AAC7F,MAAI;AAEJ,SAAO,IAAI,eAAkB;AAAA,IAC3B,SAAS;AACP,mBAAa,YAAY;AAAA,IAC3B;AAAA,IACA,MAAM,YAAY;AAChB,qBAAe,WAAW,UAAU;AAAA,QAClC,WAAW;AACT,qBAAW,MAAM;AAAA,QACnB;AAAA,QACA,MAAM,KAAc;AAClB,qBAAW,MAAM,GAAG;AAAA,QACtB;AAAA,QACA,KAAK,OAAO;AACV,qBAAW,QAAQ,KAAK;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,31 +0,0 @@
1
- import {
2
- Observable
3
- } from "./chunk-VLF6DI2U.mjs";
4
-
5
- // src/observableFromAsync.ts
6
- function observableFromAsync(iterable) {
7
- return new Observable((subscriber) => {
8
- let closed = false;
9
- (async function() {
10
- try {
11
- for await (const value of iterable) {
12
- if (closed) {
13
- break;
14
- }
15
- subscriber.next(value);
16
- }
17
- subscriber.complete();
18
- } catch (error) {
19
- subscriber.error(error);
20
- }
21
- })();
22
- return () => {
23
- closed = true;
24
- };
25
- });
26
- }
27
-
28
- export {
29
- observableFromAsync
30
- };
31
- //# sourceMappingURL=chunk-FEOLYD5R.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observableFromAsync.ts"],"sourcesContent":["import { Observable } from './Observable';\n\nexport function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T> {\n return new Observable(subscriber => {\n let closed = false;\n\n (async function () {\n try {\n for await (const value of iterable) {\n if (closed) {\n break;\n }\n\n subscriber.next(value);\n }\n\n subscriber.complete();\n } catch (error) {\n subscriber.error(error);\n }\n })();\n\n return () => {\n closed = true;\n };\n });\n}\n"],"mappings":";;;;;AAEO,SAAS,oBAAuB,UAA2C;AAChF,SAAO,IAAI,WAAW,gBAAc;AAClC,QAAI,SAAS;AAEb,KAAC,iBAAkB;AACjB,UAAI;AACF,yBAAiB,SAAS,UAAU;AAClC,cAAI,QAAQ;AACV;AAAA,UACF;AAEA,qBAAW,KAAK,KAAK;AAAA,QACvB;AAEA,mBAAW,SAAS;AAAA,MACtB,SAAS,OAAO;AACd,mBAAW,MAAM,KAAK;AAAA,MACxB;AAAA,IACF,GAAG;AAEH,WAAO,MAAM;AACX,eAAS;AAAA,IACX;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,35 +0,0 @@
1
- import {
2
- withResolvers
3
- } from "./chunk-U6G4RNZ2.mjs";
4
-
5
- // src/PushAsyncIterableIterator.ts
6
- var CLOSE = Symbol("close");
7
- var PushAsyncIterableIterator = class {
8
- #closed = false;
9
- #pushResolvers = withResolvers();
10
- [Symbol.asyncIterator]() {
11
- return this;
12
- }
13
- close() {
14
- this.#closed = true;
15
- this.#pushResolvers.resolve(CLOSE);
16
- }
17
- async next() {
18
- const value = await this.#pushResolvers.promise;
19
- if (value === CLOSE) {
20
- return { done: true, value: void 0 };
21
- }
22
- return { done: false, value };
23
- }
24
- push(value) {
25
- if (!this.#closed) {
26
- this.#pushResolvers.resolve(value);
27
- this.#pushResolvers = withResolvers();
28
- }
29
- }
30
- };
31
-
32
- export {
33
- PushAsyncIterableIterator
34
- };
35
- //# sourceMappingURL=chunk-K5XV4W7G.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/PushAsyncIterableIterator.ts"],"sourcesContent":["import withResolvers from './private/withResolvers';\n\nconst CLOSE = Symbol('close');\n\nexport class PushAsyncIterableIterator<T> implements AsyncIterableIterator<T> {\n #closed: boolean = false;\n #pushResolvers: PromiseWithResolvers<T | typeof CLOSE> = withResolvers();\n\n [Symbol.asyncIterator]() {\n return this;\n }\n\n close() {\n this.#closed = true;\n this.#pushResolvers.resolve(CLOSE);\n }\n\n async next(): Promise<IteratorResult<T>> {\n const value = await this.#pushResolvers.promise;\n\n if (value === CLOSE) {\n return { done: true, value: undefined };\n }\n\n return { done: false, value };\n }\n\n push(value: T) {\n if (!this.#closed) {\n this.#pushResolvers.resolve(value);\n this.#pushResolvers = withResolvers();\n }\n }\n}\n"],"mappings":";;;;;AAEA,IAAM,QAAQ,OAAO,OAAO;AAErB,IAAM,4BAAN,MAAuE;AAAA,EAC5E,UAAmB;AAAA,EACnB,iBAAyD,cAAc;AAAA,EAEvE,CAAC,OAAO,aAAa,IAAI;AACvB,WAAO;AAAA,EACT;AAAA,EAEA,QAAQ;AACN,SAAK,UAAU;AACf,SAAK,eAAe,QAAQ,KAAK;AAAA,EACnC;AAAA,EAEA,MAAM,OAAmC;AACvC,UAAM,QAAQ,MAAM,KAAK,eAAe;AAExC,QAAI,UAAU,OAAO;AACnB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAEA,WAAO,EAAE,MAAM,OAAO,MAAM;AAAA,EAC9B;AAAA,EAEA,KAAK,OAAU;AACb,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,eAAe,QAAQ,KAAK;AACjC,WAAK,iBAAiB,cAAc;AAAA,IACtC;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +0,0 @@
1
- // src/private/withResolvers.ts
2
- import coreJSPromiseWithResolvers from "core-js-pure/full/promise/with-resolvers";
3
- function withResolvers() {
4
- return coreJSPromiseWithResolvers();
5
- }
6
-
7
- export {
8
- withResolvers
9
- };
10
- //# sourceMappingURL=chunk-U6G4RNZ2.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/private/withResolvers.ts"],"sourcesContent":["// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n"],"mappings":";AACA,OAAO,gCAAgC;AAExB,SAAR,gBAA6D;AAClE,SAAO,2BAA2B;AACpC;","names":[]}
@@ -1,7 +0,0 @@
1
- import { Observable } from './iter-fest.observable.mjs';
2
- import 'core-js-pure/full/observable';
3
- import './iter-fest.symbolObservable.mjs';
4
-
5
- declare function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T>;
6
-
7
- export { observableFromAsync };
@@ -1,7 +0,0 @@
1
- import { Observable } from './iter-fest.observable.js';
2
- import 'core-js-pure/full/observable';
3
- import './iter-fest.symbolObservable.js';
4
-
5
- declare function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T>;
6
-
7
- export { observableFromAsync };
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/observableFromAsync.ts
31
- var observableFromAsync_exports = {};
32
- __export(observableFromAsync_exports, {
33
- observableFromAsync: () => observableFromAsync
34
- });
35
- module.exports = __toCommonJS(observableFromAsync_exports);
36
-
37
- // src/Observable.ts
38
- var import_observable2 = __toESM(require("core-js-pure/full/observable"));
39
-
40
- // src/SymbolObservable.ts
41
- var import_observable = __toESM(require("core-js-pure/features/symbol/observable"));
42
- var SymbolObservable = import_observable.default;
43
-
44
- // src/Observable.ts
45
- var Observable = class extends import_observable2.default {
46
- constructor(subscriber) {
47
- super(subscriber);
48
- }
49
- subscribe(observerOrOnNext, onError, onComplete) {
50
- return super.subscribe(observerOrOnNext, onError, onComplete);
51
- }
52
- /** Returns itself */
53
- [SymbolObservable]() {
54
- return this;
55
- }
56
- /** Converts items to an Observable */
57
- static of(...items) {
58
- return import_observable2.default.of(...items);
59
- }
60
- static from(iterableOrObservable) {
61
- return import_observable2.default.from(iterableOrObservable);
62
- }
63
- };
64
-
65
- // src/observableFromAsync.ts
66
- function observableFromAsync(iterable) {
67
- return new Observable((subscriber) => {
68
- let closed = false;
69
- (async function() {
70
- try {
71
- for await (const value of iterable) {
72
- if (closed) {
73
- break;
74
- }
75
- subscriber.next(value);
76
- }
77
- subscriber.complete();
78
- } catch (error) {
79
- subscriber.error(error);
80
- }
81
- })();
82
- return () => {
83
- closed = true;
84
- };
85
- });
86
- }
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- observableFromAsync
90
- });
91
- //# sourceMappingURL=iter-fest.observableFromAsync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observableFromAsync.ts","../src/Observable.ts","../src/SymbolObservable.ts"],"sourcesContent":["import { Observable } from './Observable';\n\nexport function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T> {\n return new Observable(subscriber => {\n let closed = false;\n\n (async function () {\n try {\n for await (const value of iterable) {\n if (closed) {\n break;\n }\n\n subscriber.next(value);\n }\n\n subscriber.complete();\n } catch (error) {\n subscriber.error(error);\n }\n })();\n\n return () => {\n closed = true;\n };\n });\n}\n","// @ts-expect-error core-js is not typed.\nimport CoreJSObservable from 'core-js-pure/full/observable';\n\nimport { SymbolObservable } from './SymbolObservable';\n\nexport interface SubscriptionObserver<T> {\n /** Sends the next value in the sequence */\n next(value: T): void;\n\n /** Sends the sequence error */\n error(errorValue: unknown): void;\n\n /** Sends the completion notification */\n complete(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport interface Subscription {\n /** Cancels the subscription */\n unsubscribe(): void;\n\n /** A boolean value indicating whether the subscription is closed */\n get closed(): boolean;\n}\n\nexport type SubscriberFunction<T> = (observer: SubscriptionObserver<T>) => (() => void) | Subscription | void;\n\nexport type CompleteFunction = () => void;\nexport type ErrorFunction = (errorValue: unknown) => void;\nexport type NextFunction<T> = (value: T) => void;\nexport type StartFunction = (subscription: Subscription) => void;\n\nexport interface Observer<T> {\n /** Receives a completion notification */\n complete?(): void;\n\n /** Receives the sequence error */\n error?(errorValue: unknown): void;\n\n /** Receives the next value in the sequence */\n next?(value: T): void;\n\n /** Receives the subscription object when `subscribe` is called */\n start?(subscription: Subscription): void;\n}\n\nexport class Observable<T> extends CoreJSObservable {\n constructor(subscriber: SubscriberFunction<T>) {\n super(subscriber);\n }\n\n /** Subscribes to the sequence with an observer */\n subscribe(observer: Observer<T>): Subscription;\n\n /** Subscribes to the sequence with callbacks */\n subscribe(\n onNext: NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription;\n\n subscribe(\n observerOrOnNext: Observer<T> | NextFunction<T>,\n onError?: ErrorFunction | undefined,\n onComplete?: CompleteFunction | undefined\n ): Subscription {\n return super.subscribe(observerOrOnNext, onError, onComplete);\n }\n\n /** Returns itself */\n [SymbolObservable](): Observable<T> {\n return this;\n }\n\n /** Converts items to an Observable */\n static of<T>(...items: T[]): Observable<T> {\n return CoreJSObservable.of(...items);\n }\n\n /** Converts an iterable to an Observable */\n static from<T>(iterable: Iterable<T>): Observable<T>;\n\n /** Converts an observable to an Observable */\n static from<T>(observable: Observable<T>): Observable<T>;\n\n static from<T>(iterableOrObservable: Iterable<T> | Observable<T>): Observable<T> {\n return CoreJSObservable.from(iterableOrObservable);\n }\n}\n","// @ts-expect-error core-js is not typed.\nimport CoreJSSymbolObservable from 'core-js-pure/features/symbol/observable';\n\nconst SymbolObservable: unique symbol = CoreJSSymbolObservable;\n\nexport { SymbolObservable };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,qBAA6B;;;ACA7B,wBAAmC;AAEnC,IAAM,mBAAkC,kBAAAC;;;AD6CjC,IAAM,aAAN,cAA4B,mBAAAC,QAAiB;AAAA,EAClD,YAAY,YAAmC;AAC7C,UAAM,UAAU;AAAA,EAClB;AAAA,EAYA,UACE,kBACA,SACA,YACc;AACd,WAAO,MAAM,UAAU,kBAAkB,SAAS,UAAU;AAAA,EAC9D;AAAA;AAAA,EAGA,CAAC,gBAAgB,IAAmB;AAClC,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,OAAO,MAAS,OAA2B;AACzC,WAAO,mBAAAA,QAAiB,GAAG,GAAG,KAAK;AAAA,EACrC;AAAA,EAQA,OAAO,KAAQ,sBAAkE;AAC/E,WAAO,mBAAAA,QAAiB,KAAK,oBAAoB;AAAA,EACnD;AACF;;;ADxFO,SAAS,oBAAuB,UAA2C;AAChF,SAAO,IAAI,WAAW,gBAAc;AAClC,QAAI,SAAS;AAEb,KAAC,iBAAkB;AACjB,UAAI;AACF,yBAAiB,SAAS,UAAU;AAClC,cAAI,QAAQ;AACV;AAAA,UACF;AAEA,qBAAW,KAAK,KAAK;AAAA,QACvB;AAEA,mBAAW,SAAS;AAAA,MACtB,SAAS,OAAO;AACd,mBAAW,MAAM,KAAK;AAAA,MACxB;AAAA,IACF,GAAG;AAEH,WAAO,MAAM;AACX,eAAS;AAAA,IACX;AAAA,EACF,CAAC;AACH;","names":["import_observable","CoreJSSymbolObservable","CoreJSObservable"]}
@@ -1,9 +0,0 @@
1
- import {
2
- observableFromAsync
3
- } from "./chunk-FEOLYD5R.mjs";
4
- import "./chunk-VLF6DI2U.mjs";
5
- import "./chunk-OJMT4K3R.mjs";
6
- export {
7
- observableFromAsync
8
- };
9
- //# sourceMappingURL=iter-fest.observableFromAsync.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,7 +0,0 @@
1
- import { Observable } from './iter-fest.observable.mjs';
2
- import 'core-js-pure/full/observable';
3
- import './iter-fest.symbolObservable.mjs';
4
-
5
- declare function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T>;
6
-
7
- export { observableSubscribeAsReadable };
@@ -1,7 +0,0 @@
1
- import { Observable } from './iter-fest.observable.js';
2
- import 'core-js-pure/full/observable';
3
- import './iter-fest.symbolObservable.js';
4
-
5
- declare function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T>;
6
-
7
- export { observableSubscribeAsReadable };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/observableSubscribeAsReadable.ts
21
- var observableSubscribeAsReadable_exports = {};
22
- __export(observableSubscribeAsReadable_exports, {
23
- observableSubscribeAsReadable: () => observableSubscribeAsReadable
24
- });
25
- module.exports = __toCommonJS(observableSubscribeAsReadable_exports);
26
- function observableSubscribeAsReadable(observable) {
27
- let subscription;
28
- return new ReadableStream({
29
- cancel() {
30
- subscription.unsubscribe();
31
- },
32
- start(controller) {
33
- subscription = observable.subscribe({
34
- complete() {
35
- controller.close();
36
- },
37
- error(err) {
38
- controller.error(err);
39
- },
40
- next(value) {
41
- controller.enqueue(value);
42
- }
43
- });
44
- }
45
- });
46
- }
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- observableSubscribeAsReadable
50
- });
51
- //# sourceMappingURL=iter-fest.observableSubscribeAsReadable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observableSubscribeAsReadable.ts"],"sourcesContent":["import type { Observable, Subscription } from './Observable';\n\nexport function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T> {\n let subscription: Subscription;\n\n return new ReadableStream<T>({\n cancel() {\n subscription.unsubscribe();\n },\n start(controller) {\n subscription = observable.subscribe({\n complete() {\n controller.close();\n },\n error(err: unknown) {\n controller.error(err);\n },\n next(value) {\n controller.enqueue(value);\n }\n });\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,8BAAiC,YAA8C;AAC7F,MAAI;AAEJ,SAAO,IAAI,eAAkB;AAAA,IAC3B,SAAS;AACP,mBAAa,YAAY;AAAA,IAC3B;AAAA,IACA,MAAM,YAAY;AAChB,qBAAe,WAAW,UAAU;AAAA,QAClC,WAAW;AACT,qBAAW,MAAM;AAAA,QACnB;AAAA,QACA,MAAM,KAAc;AAClB,qBAAW,MAAM,GAAG;AAAA,QACtB;AAAA,QACA,KAAK,OAAO;AACV,qBAAW,QAAQ,KAAK;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -1,7 +0,0 @@
1
- import {
2
- observableSubscribeAsReadable
3
- } from "./chunk-EIIP7YWB.mjs";
4
- export {
5
- observableSubscribeAsReadable
6
- };
7
- //# sourceMappingURL=iter-fest.observableSubscribeAsReadable.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +0,0 @@
1
- declare class PushAsyncIterableIterator<T> implements AsyncIterableIterator<T> {
2
- #private;
3
- [Symbol.asyncIterator](): this;
4
- close(): void;
5
- next(): Promise<IteratorResult<T>>;
6
- push(value: T): void;
7
- }
8
-
9
- export { PushAsyncIterableIterator };
@@ -1,9 +0,0 @@
1
- declare class PushAsyncIterableIterator<T> implements AsyncIterableIterator<T> {
2
- #private;
3
- [Symbol.asyncIterator](): this;
4
- close(): void;
5
- next(): Promise<IteratorResult<T>>;
6
- push(value: T): void;
7
- }
8
-
9
- export { PushAsyncIterableIterator };
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/PushAsyncIterableIterator.ts
31
- var PushAsyncIterableIterator_exports = {};
32
- __export(PushAsyncIterableIterator_exports, {
33
- PushAsyncIterableIterator: () => PushAsyncIterableIterator
34
- });
35
- module.exports = __toCommonJS(PushAsyncIterableIterator_exports);
36
-
37
- // src/private/withResolvers.ts
38
- var import_with_resolvers = __toESM(require("core-js-pure/full/promise/with-resolvers"));
39
- function withResolvers() {
40
- return (0, import_with_resolvers.default)();
41
- }
42
-
43
- // src/PushAsyncIterableIterator.ts
44
- var CLOSE = Symbol("close");
45
- var PushAsyncIterableIterator = class {
46
- #closed = false;
47
- #pushResolvers = withResolvers();
48
- [Symbol.asyncIterator]() {
49
- return this;
50
- }
51
- close() {
52
- this.#closed = true;
53
- this.#pushResolvers.resolve(CLOSE);
54
- }
55
- async next() {
56
- const value = await this.#pushResolvers.promise;
57
- if (value === CLOSE) {
58
- return { done: true, value: void 0 };
59
- }
60
- return { done: false, value };
61
- }
62
- push(value) {
63
- if (!this.#closed) {
64
- this.#pushResolvers.resolve(value);
65
- this.#pushResolvers = withResolvers();
66
- }
67
- }
68
- };
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- PushAsyncIterableIterator
72
- });
73
- //# sourceMappingURL=iter-fest.pushAsyncIterableIterator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/PushAsyncIterableIterator.ts","../src/private/withResolvers.ts"],"sourcesContent":["import withResolvers from './private/withResolvers';\n\nconst CLOSE = Symbol('close');\n\nexport class PushAsyncIterableIterator<T> implements AsyncIterableIterator<T> {\n #closed: boolean = false;\n #pushResolvers: PromiseWithResolvers<T | typeof CLOSE> = withResolvers();\n\n [Symbol.asyncIterator]() {\n return this;\n }\n\n close() {\n this.#closed = true;\n this.#pushResolvers.resolve(CLOSE);\n }\n\n async next(): Promise<IteratorResult<T>> {\n const value = await this.#pushResolvers.promise;\n\n if (value === CLOSE) {\n return { done: true, value: undefined };\n }\n\n return { done: false, value };\n }\n\n push(value: T) {\n if (!this.#closed) {\n this.#pushResolvers.resolve(value);\n this.#pushResolvers = withResolvers();\n }\n }\n}\n","// @ts-expect-error \"core-js\" is not typed.\nimport coreJSPromiseWithResolvers from 'core-js-pure/full/promise/with-resolvers';\n\nexport default function withResolvers<T>(): PromiseWithResolvers<T> {\n return coreJSPromiseWithResolvers();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,4BAAuC;AAExB,SAAR,gBAA6D;AAClE,aAAO,sBAAAA,SAA2B;AACpC;;;ADHA,IAAM,QAAQ,OAAO,OAAO;AAErB,IAAM,4BAAN,MAAuE;AAAA,EAC5E,UAAmB;AAAA,EACnB,iBAAyD,cAAc;AAAA,EAEvE,CAAC,OAAO,aAAa,IAAI;AACvB,WAAO;AAAA,EACT;AAAA,EAEA,QAAQ;AACN,SAAK,UAAU;AACf,SAAK,eAAe,QAAQ,KAAK;AAAA,EACnC;AAAA,EAEA,MAAM,OAAmC;AACvC,UAAM,QAAQ,MAAM,KAAK,eAAe;AAExC,QAAI,UAAU,OAAO;AACnB,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAEA,WAAO,EAAE,MAAM,OAAO,MAAM;AAAA,EAC9B;AAAA,EAEA,KAAK,OAAU;AACb,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,eAAe,QAAQ,KAAK;AACjC,WAAK,iBAAiB,cAAc;AAAA,IACtC;AAAA,EACF;AACF;","names":["coreJSPromiseWithResolvers"]}
@@ -1,8 +0,0 @@
1
- import {
2
- PushAsyncIterableIterator
3
- } from "./chunk-K5XV4W7G.mjs";
4
- import "./chunk-U6G4RNZ2.mjs";
5
- export {
6
- PushAsyncIterableIterator
7
- };
8
- //# sourceMappingURL=iter-fest.pushAsyncIterableIterator.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,3 +0,0 @@
1
- declare function readerToAsyncIterableIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T>;
2
-
3
- export { readerToAsyncIterableIterator };
@@ -1,3 +0,0 @@
1
- declare function readerToAsyncIterableIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T>;
2
-
3
- export { readerToAsyncIterableIterator };
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/readerToAsyncIterableIterator.ts
21
- var readerToAsyncIterableIterator_exports = {};
22
- __export(readerToAsyncIterableIterator_exports, {
23
- readerToAsyncIterableIterator: () => readerToAsyncIterableIterator
24
- });
25
- module.exports = __toCommonJS(readerToAsyncIterableIterator_exports);
26
- function readerToAsyncIterableIterator(reader) {
27
- const iterable = {
28
- [Symbol.asyncIterator]() {
29
- return iterable;
30
- },
31
- async next() {
32
- const result = await Promise.race([reader.read(), reader.closed]);
33
- if (!result || result.done) {
34
- return { done: true, value: void 0 };
35
- }
36
- return { value: result.value };
37
- }
38
- };
39
- return iterable;
40
- }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- readerToAsyncIterableIterator
44
- });
45
- //# sourceMappingURL=iter-fest.readerToAsyncIterableIterator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/readerToAsyncIterableIterator.ts"],"sourcesContent":["export function readerToAsyncIterableIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T> {\n const iterable = {\n [Symbol.asyncIterator]() {\n return iterable;\n },\n async next(): Promise<IteratorResult<T>> {\n const result = await Promise.race([reader.read(), reader.closed]);\n\n if (!result || result.done) {\n return { done: true, value: undefined };\n }\n\n return { value: result.value };\n }\n };\n\n return iterable;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,8BAAiC,QAAkE;AACjH,QAAM,WAAW;AAAA,IACf,CAAC,OAAO,aAAa,IAAI;AACvB,aAAO;AAAA,IACT;AAAA,IACA,MAAM,OAAmC;AACvC,YAAM,SAAS,MAAM,QAAQ,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,MAAM,CAAC;AAEhE,UAAI,CAAC,UAAU,OAAO,MAAM;AAC1B,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAEA,aAAO,EAAE,OAAO,OAAO,MAAM;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,7 +0,0 @@
1
- import {
2
- readerToAsyncIterableIterator
3
- } from "./chunk-2HLJODU3.mjs";
4
- export {
5
- readerToAsyncIterableIterator
6
- };
7
- //# sourceMappingURL=iter-fest.readerToAsyncIterableIterator.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}