@fbltd/async 1.0.26 → 1.0.27

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.
@@ -1,4 +1,3 @@
1
- import { symAI } from "../../constants.js";
2
1
  import { PromiseConfiguration } from "../../promise-configuration.js";
3
2
  /**
4
3
  * @internal
@@ -7,13 +6,14 @@ export const StreamFinishError = new Error("Stream is done");
7
6
  export function next(dep) {
8
7
  const disposePromise = new PromiseConfiguration();
9
8
  const resultPromise = new PromiseConfiguration();
10
- dep[symAI]({ externalDispose: disposePromise })
11
- .next()
9
+ Promise.race([dep.next(), disposePromise.promise])
12
10
  .then((res) => {
13
- if (res.done)
11
+ if (dep.done || disposePromise.isFulfilled) {
14
12
  resultPromise.reject(StreamFinishError);
15
- else
16
- resultPromise.resolve(res.value);
13
+ }
14
+ else {
15
+ resultPromise.resolve(dep.value);
16
+ }
17
17
  });
18
18
  return {
19
19
  promise: resultPromise.promise,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fbltd/async",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Miscellaneous async utils",
5
5
  "homepage": "https://github.com/GlennMiller1991/async",
6
6
  "type": "module",