diff options
Diffstat (limited to 'src/utils/boolean.ts')
-rw-r--r-- | src/utils/boolean.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/boolean.ts b/src/utils/boolean.ts new file mode 100644 index 0000000..9e842ea --- /dev/null +++ b/src/utils/boolean.ts @@ -0,0 +1,10 @@ +export { isNotThrowing }; + +function isNotThrowing(cb: () => unknown): boolean { + try { + cb(); + return true; + } catch (_) { + return false; + } +} |