throwIf()
function throwIf(predicate): Promise<void>
Resolves promise if condition is falsy, otherwise throws an error.
This is useful for early returns in async functions.
Parameters
Parameter | Type |
---|---|
predicate | unknown |
Returns
Promise
<void
>
See
continueIf
for the opposite behavior.