UNPKG

586 BJavaScriptView Raw
1import { invariant } from "../../utilities/globals/index.js";
2export function toPromise(observable) {
3 var completed = false;
4 return new Promise(function (resolve, reject) {
5 observable.subscribe({
6 next: function (data) {
7 if (completed) {
8 globalThis.__DEV__ !== false && invariant.warn(43);
9 }
10 else {
11 completed = true;
12 resolve(data);
13 }
14 },
15 error: reject,
16 });
17 });
18}
19//# sourceMappingURL=toPromise.js.map
\No newline at end of file