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 isFailureAsync(fn: () => Awaitable<unknown>): Promise<boolean> { try { await fn() return false } catch { return true } }