@ynmstudio/utils
Version:
YNM Utilities for Angular
19 lines (15 loc) • 632 B
JavaScript
import { computed } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { of } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
function toSignalWithError(obs$) {
const source = toSignal(obs$.pipe(map((value) => ({ value, error: undefined })), catchError((err) => of({ value: undefined, error: err }))));
const value = computed(() => source()?.value);
const error = computed(() => source()?.error);
return { value, error };
}
/**
* Generated bundle index. Do not edit.
*/
export { toSignalWithError };
//# sourceMappingURL=ynmstudio-utils-signal-with-error.mjs.map