typia
Version:
Superfast runtime validators with only one line
14 lines (12 loc) • 344 B
text/typescript
import { TypeGuardError } from "../TypeGuardError";
export const _assertGuard = (
exceptionable: boolean,
props: TypeGuardError.IProps,
factory?: (props: TypeGuardError.IProps) => Error,
): false => {
if (exceptionable === true) {
if (factory) throw factory(props);
else throw new TypeGuardError(props);
}
return false;
};