start onwMemberhsip.ts

This commit is contained in:
Timo K
2025-10-30 15:15:49 +01:00
parent c8ef8d6a24
commit 4f892e358a
5 changed files with 175 additions and 96 deletions
+7
View File
@@ -6,6 +6,7 @@ Please see LICENSE in the repository root for full details.
*/
import { catchError, from, map, type Observable, of, startWith } from "rxjs";
import { Behavior } from "./Behavior";
/**
* Data that may need to be loaded asynchronously.
@@ -51,3 +52,9 @@ export function mapAsync<A, B>(
): Async<B> {
return async.state === "ready" ? ready(project(async.value)) : async;
}
export function unwrapAsync<A>(fallback: A): (async: Async<A>) => A {
return (async: Async<A>) => {
return async.state === "ready" ? async.value : fallback;
};
}