UNPKG

rx-nostr

Version:

A library based on RxJS, which allows Nostr applications to easily communicate with relays.

15 lines (14 loc) 227 B
export function inlineTry<T, U>( f: () => T, g: U | ((err: unknown) => U), ): T | U { try { return f(); } catch (err) { if (g instanceof Function) { return g(err); } else { return g; } } }