it-tools/src/utils/boolean.ts
2023-05-28 23:29:14 +02:00

16 lines
273 B
TypeScript

export { isNotThrowing, booleanToHumanReadable };
function isNotThrowing(cb: () => unknown): boolean {
try {
cb();
return true;
}
catch (_) {
return false;
}
}
function booleanToHumanReadable(value: boolean): string {
return value ? 'Yes' : 'No';
}