prettier !

This commit is contained in:
Valere
2025-10-07 16:24:02 +02:00
parent 7437961195
commit 529cb8a7ec
12 changed files with 547 additions and 421 deletions

View File

@@ -5,14 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import {
catchError,
from,
map,
type Observable,
of,
startWith
} from "rxjs";
import { catchError, from, map, type Observable, of, startWith } from "rxjs";
// TODO where are all the comments? ::cry::
// There used to be an unitialized state!, a state might not start in loading
@@ -34,13 +27,15 @@ export function async$<A>(promise: Promise<A>): Observable<Async<A>> {
return from(promise).pipe(
map(ready),
startWith(loading),
catchError((e: unknown) => of(error(e as Error ?? new Error("Unknown error")))),
catchError((e: unknown) =>
of(error((e as Error) ?? new Error("Unknown error"))),
),
);
}
export function mapAsync<A, B>(
async: Async<A>,
project: (value: A) => B
project: (value: A) => B,
): Async<B> {
return async.state === "ready" ? ready(project(async.value)) : async;
}