UNPKG

return-style

Version:

Non-intrusively convert the result of any function or promise to the user's desired style.

11 lines (9 loc) 210 B
import { Awaitable } from '@blackglory/prelude' export async function isSuccessAsync(fn: () => Awaitable<unknown>): Promise<boolean> { try { await fn() return true } catch { return false } }